Creating a new TwitterSession causing null object reference Error

android

#1

In my android application, I authenticate using Twitter and navigate to a new Activity.
So when I try to recreate a session/get the already available Session, when I try to use this code

"TwitterSession session = Twitter.getSessionManager().getActiveSession();"

I am getting this error.

“Attempt to invoke interface method ‘com.twitter.sdk.android.core.Session com.twitter.sdk.android.core.SessionManager.getActiveSession()’ on a null object reference”

Can someone help me fix this issue.


Twitter.getSessionManager() is null / using fabric-generated ios token
#2

Not sure, but are you using Digits or are you using Twitter.

If you are using Digits, your code should look like this: Digits.getSessionManager().getActiveSession()


#3