My Code is:-
try
{
params.putString("fields", "first_name");
params.putString("fields", "last_name");
params.putString("fields", "link");
params.putString("fields", "gender");
params.putString("fields", "birthday");
JSONObject json = new JSONObject(facebook.request(Id, params));
JSONArray array = json.getJSONArray("data");
if(array != null)
{
for(int i=0;i<array.length();i++)
{
String name = array.getJSONObject(i).getString("name");
String birthday = array.getJSONObject(i).getString("friends_birthday");
String location = array.getJSONObject(i).getString("friends_location");
String web = array.getJSONObject(i).getString("friends_website");
System.out.println(name+"-"+birthday+"-"+location+"-"+web);
}
}
}
catch(Exception e)
{
}
where do I am commtting mistake. please help me. Thanks in Advance
we can get the details of a user's friends Bundle params = new Bundle(); String accessToken = facebook.getAccessToken();
try
{
params.putString("format", "json");
params.putString("access_token", accessToken);
String url = "https://graph.facebook.com/"+Id;
String response = Util.openUrl(url, "GET", params);
JSONObject json = Util.parseJson(response);
String fname = json.getString("first_name");
String lname = json.getString("last_name");
String birthday = json.getString("birthday");
String gender = json.getString("gender");
String location = json.getString("locale");
String web = json.getString("link");
}
catch(Exception e)
{
}
it is very hard to help you without you telling us what you are trying to do with your code and what is going wrong with it.
However, by looking at your code, I would tell you to confirm that you are putting the fields you want in the correct way. If params works like an hashtable, you would be overritting the values for key "fields" - so instead of asking for first_name, last_name, etc you would be asking only for birthday.
精彩评论