Hello everyone, I work with VC. There was a plug with the output of the name of an authorized user in my application. I can not parse the received response. Tell me who faced. Here is a piece of code

public void onComplete(VKResponse response) { super.onComplete(response); JSONArray resp = new JSONArray(); try { resp = response.json.getJSONArray("response"); } catch (JSONException e) { e.printStackTrace(); } JSONObject user = new JSONObject(); try { user = resp.getJSONObject(0); } catch (JSONException e) { e.printStackTrace(); } userName.setText(user.toString()); } 

    1 answer 1

    apparently earned) VKApi.users().get().executeWithListener(new VKRequest.VKRequestListener() { @Override public void onComplete(VKResponse response) { VKApiUser user = ((VKList<VKApiUser>)response.parsedModel).get(0); userName.setText(user.first_name + " " + user.last_name); } });