Get Facebook User ID OnMapLongClickListener android -
i want pass via intent facebook id, in google map.
i have onmaplongclicklistener latlng , pass via intent, , want pass facebook user id too...how can this?
onmaplongclicklistener
googlemap.setonmaplongclicklistener(new googlemap.onmaplongclicklistener() { @override public void onmaplongclick(final latlng latlng) { intent intent = new intent(mainactivity.this,newevent.class); latlng posicao = latlng; latlng posicao1 = latlng; intent.putextra("posicao", posicao); bundle args = new bundle(); args.putparcelable("posicao1", posicao1); intent.putextra("bundle", args); startactivity(intent); } });
i retrieve facebook id in method
// methods facebook public void onsessionstatechanged(final session session, sessionstate state, exception exception){ if(session != null && session.isopened()){ toast.maketext(getbasecontext(),"conectado!!", toast.length_long).show(); request.newmerequest(session, new request.graphusercallback() { @override public void oncompleted(graphuser user, response response) { if(user != null){ //final textview tv = (textview) findviewbyid(r.id.idface); //tv.settext(user.getid()); log.i("script", "usuário conectado " + user.getid()); getfriends(session); } } }).executeasync(); } else{ log.i("script", "usuario não conectado"); } }
i don't have android or java dev environment, might not compile, should give idea. facebook user id stored inside field called userid
. i've called activity myactivity
- assume code inside activity
class myactivity extends activity implements onmaplongclicklistener { private string userid; @override public void onmaplongclick(final latlng latlng) { intent intent = new intent(mainactivity.this,newevent.class); latlng posicao = latlng; latlng posicao1 = latlng; intent.putextra("posicao", posicao); intent.putextra("userid", userid); bundle args = new bundle(); args.putparcelable("posicao1", posicao1); intent.putextra("bundle", args); startactivity(intent); } public void onsessionstatechanged(final session session, sessionstate state, exception exception){ if(session != null && session.isopened()){ toast.maketext(getbasecontext(),"conectado!!", toast.length_long).show(); request.newmerequest(session, new request.graphusercallback() { @override public void oncompleted(graphuser user, response response) { if(user != null){ //final textview tv = (textview) findviewbyid(r.id.idface); userid = user.getid(); log.i("script", "usuário conectado " + user.getid()); getfriends(session); } } }).executeasync(); } else{ log.i("script", "usuario não conectado"); } }
the code below called do, somewhere inside activity
:
googlemap.setonmaplongclicklistener(this);