Android Twitter authenticate code change in twitter4j-core-2.2.5.jar
<p>I am working in an Android application that can post tweets and picture to Twitter. I was using twitter4j-core-2.1.11. Now I have upgraded to twitter4j-core-2.2.5.jar since twitter4j-core-2.1.11 does not have the property to add upload picture while tweeting.</p>

<p>This is the code that I used to authenticate in twitter4j-core-2.1.11.</p>

<pre><code>public static boolean isAuthenticated(SharedPreferences prefs) {
  String token = prefs.getString(OAuth.OAUTH_TOKEN, "");
  String secret = prefs.getString(OAuth.OAUTH_TOKEN_SECRET, "");
  AccessToken accesstoken = new AccessToken(token, secret);
  Twitter twitter = new TwitterFactory().getInstance();
  twitter.setOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
  twitter.setOAuthAccessToken(accesstoken);
  try {
    twitter.getAccountSettings();
      return true;
  } catch (TwitterException e) {
    return false;
  }
}
</code></pre>

<p>Now I get the error:</p>

<p><strong>AndroidRuntime(694): Caused by: java.lang.IllegalArgumentException: Invalid access token format.</strong></p>
