VKSdk Request
Добавлено: 09 май 2015, 12:14
Суть проблеми состоит в том что Мне надо получить запросом из ВК Имя Фамилию и Фото пользователя, Но я почемуто могу получить только 2 параметра ( Имя Фамилия/Имя фото/Фамилия Фото). Как только я питаюсь получить 3 параметра то мне Request ничего не возвращает. В чем проблема?
Вот код +- пара скобок
Если есть какието вариантьі почему не пашет внимательно слушаю.
Код: Выделить всё
VKParameters params = new VKParameters();
params.put(VKApiConst.FIELDS, "last_name");
VKRequest request = null;
request = new VKRequest("users.get",params);
Log.d(LOG_TAG,"param");
VKParameters params1 = new VKParameters();
params1.put(VKApiConst.FIELDS,"first_name");
VKRequest request1 = null;
request1 = new VKRequest("users.get",params1);
VKParameters params2 = new VKParameters();
params2.put(VKApiConst.FIELDS,"photo_max_orig");
VKRequest request2 = null;
request2 = new VKRequest("users.get",params2);
VKBatchRequest batch_req = new VKBatchRequest(request,request1,request2);
batch_req.executeWithListener(new VKBatchRequestListener() {
@Override
public void onComplete(VKResponse[] responses) {
super.onComplete(responses);
JSONArray resp = new JSONArray();
JSONArray resp1 = new JSONArray();
JSONArray resp2 = new JSONArray();
try {
resp = responses[0].json.getJSONArray("response");
resp1 = responses[1].json.getJSONArray("response");
resp2 = responses[2].json.getJSONArray("response");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JSONObject user = new JSONObject();
try {
user = resp.getJSONObject(0);
user = resp1.getJSONObject(0);
user = resp2.getJSONObject(0);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
String name = user.getString("first_name");
String last = user.getString("photo_max_orig");
String url = user.getString("photo_max_orig");
Log.d(LOG_TAG, "url"+url);
Log.d(LOG_TAG, "url");
names.setVisibility(View.VISIBLE);
names.setText(name+" "+last);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void onError(VKError error) {
super.onError(error);
}
});Если есть какието вариантьі почему не пашет внимательно слушаю.