1

I would like to pass Facebook session information between two acvtivities so that I can authenticate one user in 1st session and use that session information to post a message to a wall in 2nd activity.

What's the way of doing this simple task? Should I keep token and expire information and create a new session with these two variables or some other way?

I'm struggling on that one for one week already so prompt answers, sample code, info etc appreciated very much.

Marcin Gil
  • 68,043
  • 8
  • 59
  • 60
user645965
  • 31
  • 4

1 Answers1

0

From the 1st activity, you should start the 2nd activity by calling startActivity() or startActivityForResult(), passing the Facebook session to the sending Intent.

intent.putExtra("FBSession", sessionValue); // assuming session in a string

In 2nd activity, inside onCreate(), calling getIntent().getString("FBSession") to receive value sent from 1st activity.

Pete Houston
  • 14,931
  • 6
  • 47
  • 60
  • By using intends I think you can only pass primitive data types like int, string etc. right? – user645965 Oct 06 '11 at 13:30
  • By custom objects, you can try serialize them but it would result in slow performance. Or you can implement `Parcelable`. Please refer to my tutorial on `Parcelable Object`: http://xjaphx.wordpress.com/2011/06/24/pass-complex-object-structure-to-intent/ – Pete Houston Oct 06 '11 at 13:37