0

I am new to using Android Studio and coding in Java.

I created a Twitter log in button using Fabric and I want to create a new activity to show the user's twitter feed. I need to pass the TwitterSession result variable to make API calls in the other activity, but I don't know which function to use to pass it.

I created a new intent and looked into using putExtra() to pass the variable, but I don't know what to pass it as. Serializable doesn't work when I try to cast it back to a TwitterSession.

What should I use in order to pass this variable?

Elddir
  • 3
  • 3
  • Could ypu provide us your code and tell us your problem in detail so we can try to help you with the problem which stops you from going forward. – bish Jul 08 '15 at 04:28

2 Answers2

0

you can call api twitter on layout login, then save result to SharePreferences. then in another class just enough to read from sharepreference

souttab
  • 696
  • 6
  • 12
0

The easiest way would be to make your twitterSessionResult variable static in your LogInActivity and access it in you new Activity via: LogInActivity.twitterSessionResult.

Lukas Lechner
  • 7,881
  • 7
  • 40
  • 53
  • Unfortunately, the result variable is not a constant, so I can't make it static. Very interesting idea however, I'll be sure to use it later in my project – Elddir Jul 08 '15 at 08:06