android - access facebook page information -
i want facebook page about, description, location, basic info etc. have got access token page. getting likes of page this:
public void getlikes (string id,final textview likes,final int position) { session session = session.getactivesession(); bundle params = new bundle(); params.putstring("id", id); params.putstring("fields", "likes"); request request = new request(session, "search", params, httpmethod.get, new request.callback() { @override public void oncompleted(response response) { try { jsonobject res = response.getgraphobject().getinnerjsonobject().getjsonarray("data").getjsonobject(0); if (res.length()>1){ likes.settext(string.valueof(res.getint("likes"))); preferences.data.getdata().get(position).setlikes(string.valueof(res.getint("likes"))); } else { preferences.data.getdata().get(position).setlikes("no likes"); likes.settext("0"); } } catch (exception e) { } } }); requestasynctask task = new requestasynctask(request); task.execute(); }
if add more parameters in bundle, value of last parameter added, should do. facebook's documentation graph api not clear.
this isn't issue specific api, you're using 1 field of response (.getjsonobject(0)
)
if request multiple fields need @ each of them, you're fetching first
Comments
Post a Comment