Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void amigos(String id){
- // final String returnString="prueba " ;
- //final String canamigo="0";
- new GraphRequest(
- AccessToken.getCurrentAccessToken(),
- "/me/friends",
- null,
- HttpMethod.GET,
- new GraphRequest.Callback() {
- public void onCompleted(GraphResponse response) {
- /* handle the result */
- String nombres="nombres: ";
- String otro="nombres: ";
- try {
- JSONObject json_data=response.getJSONObject();
- JSONArray frienArray = ((JSONArray) (response.getJSONObject().get("data")));
- System.out.println("este es el jsom"+json_data);
- //JSONArray aray=json_data.getJSONArray("data");
- System.out.println("este es el array2"+frienArray.length());
- if(frienArray!=null) {
- System.out.println("no es nulo "+frienArray);
- for (int i = 0; i < frienArray.length(); i++) {
- JSONObject amigo = frienArray.getJSONObject(i);
- System.out.println("nombre de la persona :-"+amigo.getString("first_name"));
- otro= amigo.getString("first_name");
- }
- }
- TextView listaAmigos=(TextView) findViewById(R.id.nombres);
- listaAmigos.setText(otro);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- }
- ).executeAsync();
- TextView listaAmigos=(TextView) findViewById(R.id.nombres);
- listaAmigos.setText(id);
- Log.d(id, "onCompleted: esto es el id");
- }
Add Comment
Please, Sign In to add comment