android - Getting null graphobject in facebook respone -



android - Getting null graphobject in facebook respone -

i trying facebook friendlist profile image didn't success in it. here code

public class mainactivity extends activity { private final static string tag = "mainactivity"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); session.openactivesession(this, true, new session.statuscallback(){ @override public void call(session session, sessionstate state, exception exception) { requestmyappfacebookfriends(session); } }); } private request createrequest(session session) { request request = request.newgraphpathrequest(session, "me/friends", null); set<string> fields = new hashset<string>(); string[] requiredfields = new string[] { "id", "name", "picture"}; fields.addall(arrays.aslist(requiredfields)); bundle parameters = request.getparameters(); parameters.putstring("fields", textutils.join(",", fields)); request.setparameters(parameters); homecoming request; } private void requestmyappfacebookfriends(session session) { request friendsrequest = createrequest(session); friendsrequest.setcallback(new request.callback() { @override public void oncompleted(response response) { list<graphuser> friends = getresults(response); log.v(tag, "friends list size "+friends.size()); } }); friendsrequest.executeasync(); } private list<graphuser> getresults(response response) { graphmultiresult multiresult = response.getgraphobjectas(graphmultiresult.class); graphobjectlist<graphobject> info = multiresult.getdata(); homecoming data.casttolistof(graphuser.class); } @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); session.getactivesession().onactivityresult(this, requestcode, resultcode, data); }

the problem facing when seek graphobject response.getgraphobjectas(graphmultiresult.class) returns null. guide me i'm doing wrong here or there other way of getting facebook friend.

probably you're using v2.0 of graph api. that, you'll friends utilize same app.

see retrieve total list of friends using facebook api

android facebook

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -