How to Parse Facebook Data

前端 未结 2 1647
星月不相逢
星月不相逢 2021-01-14 23:29

I am having a few problems getting Facebook data to parse properly.

I am working on implementing part of an application to allow a user to select and use one of thei

相关标签:
2条回答
  • 2021-01-15 00:10

    why don't you try with the json classes...

    something like this:

            jsonObject = new JSONObject(your_data);
            jArray = jsonObject.getJSONArray("data");
    
            for(int i =0;i<jArray.length();i++){
    
                String name= jArray.getJSONObject(i).getString("name");
                String location= jArray.getJSONObject(i).getString("location");
    

    etc.

    0 讨论(0)
  • 2021-01-15 00:32

    The new Android Facebook SDK 3.0 returns a Response object in the Response.Callback() listener when making Graph API calls. This response object can be used to create a GraphObject which can be used to get a JSON...ex:

    Request graphRequest = Request.newGraphPathRequest(session, graphRequestString, new Request.Callback() {
    
            @Override
            public void onCompleted(Response response) {
                //Create the GraphObject from the response
                GraphObject responseGraphObject = response.getGraphObject();
    
               //Create the JSON object
               JSONObject json = responseGraphObject.getInnerJSONObject();
    
            }
    });
    
    0 讨论(0)
提交回复
热议问题