Thursday, April 12, 2012

callback url creating new activity instead of resuming in android

I am facing problem in twitter integration with android.
Everything is working fine it goes to browser asks for credentials, and comes back to app again thru callbackURL.



And here problem arises instead of resuming the activity from where i called, it is creating
a new one which costs me loosing all the variables data that i want after authentication.



My layout is like this:- on checking facebook check-box or twitter check-box it calls the respective authentication window and then (resumes the activity) itz working fine with facebook but not with twitter which results in creation a new activity



after authentication the user can post the data he had in edit text to selected server



 @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

facebook.authorizeCallback(requestCode, resultCode, data);
}


//////////////////////////////Twitter/////////////////////////////

public void LoginTwitter(){
if (TwitterUtils.isAuthenticated(prefs)) {
//sendTweet();
} else {
Intent i = new Intent(getApplicationContext(), PrepareRequestTokenActivity.class);
//i.putExtra("tweet_msg",getTweetMsg());
startActivityForResult(i, 1);
}
}


Problem :- how to make the activity resume on callback so that edit-text retains itz data



Thanks in advance





1 comment:

  1. SharesPreferences came as a saviour..

    You can use sharedpreferences to save the state of your page..

    example for how to use shared preferences can be found here

    shared preferences

    ReplyDelete