Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to get user photos link on android using Facebook SDK 4.0 and graph API.
I wrote this code to parse and get photos link -

C#
new GraphRequest(

                AccessToken.getCurrentAccessToken(),
                        "/" + userId + "/photos",
                        null,
                        HttpMethod.GET,
                        new GraphRequest.Callback() {
                            public void onCompleted(GraphResponse response) {

                                json = response.getJSONObject();

                                try {
                                    jarray = json.getJSONArray("data");

                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }

                                for(int i = 0; i < jarray.length(); i++){

                                    try {
                                        URL1 = json.getString("url");
                                        info.setText(URL1.toString());
                                        Log.d("got URLSSSs", URL1.toString());
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }

                                }
                            }
                        }
                ).executeAsync();


But its neither showing any error nor getting any URLs/links. Can anyone tell whats wrong here ?
Posted

1 solution

Replaced
URL1 = json.getString("url");
with
URL1 = oneAlbum.getString("source");

It works now.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900