i'm developing application based on facebook 4.0 login. user can log in in login.activity , main.activity shown.
after user logged in, accesstoken.getcurrentaccesstoken() not null , i'm able perform graph request.
parsefacebookutils.loginwithreadpermissionsinbackground(...)
then
accesstoken token = accesstoken.getcurrentaccesstoken(); if(token != null) graphrequest request = graphrequest.newmerequest(token, ...)
but after intent, accesstoken.getcurrentaccesstoken() null.
do have idea why accesstoken cannot used across acitivies ?
thanks,
you can declare accesstoken static, in mainactivity, initialize in oncreate, , can use in other activities.
or best way, share throw intent, here, what's best way share data between activities?
send data inside intents
intent intent = new intent(firstactivity.this, secondactivity.class); intent.putextra("some_key", value); intent.putextra("some_other_key", "a value"); startactivity(intent);
on second activity:
bundle bundle = getintent().getextras(); int value = bundle.getint("some_key"); string value2 = bundle.getstring("some_other_key");
ps: snipped code toked shared post
Comments
Post a Comment