public OAuth getOAuthToken() {
   // Restore preferences
   SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
   String oauthTokenString = settings.getString(KEY_OAUTH_TOKEN, null);
   String tokenSecret = settings.getString(KEY_TOKEN_SECRET, null);
   if (oauthTokenString == null && tokenSecret == null) {
     logger.warn("No oauth token retrieved"); // $NON-NLS-1$
     return null;
   }
   OAuth oauth = new OAuth();
   String userName = settings.getString(KEY_USER_NAME, null);
   String userId = settings.getString(KEY_USER_ID, null);
   if (userId != null) {
     User user = new User();
     user.setUsername(userName);
     user.setId(userId);
     oauth.setUser(user);
   }
   OAuthToken oauthToken = new OAuthToken();
   oauth.setToken(oauthToken);
   oauthToken.setOauthToken(oauthTokenString);
   oauthToken.setOauthTokenSecret(tokenSecret);
   logger.debug(
       "Retrieved token from preference store: oauth token={}, and token secret={}",
       oauthTokenString,
       tokenSecret); //$NON-NLS-1$
   return oauth;
 }
  public static OAuth getOAuthToken() {
    String oauthTokenString = CacheManager.getStringCacheData(KEY_OAUTH_TOKEN);
    String tokenSecret = CacheManager.getStringCacheData(KEY_TOKEN_SECRET);
    if (StringUtils.isNull(oauthTokenString) && StringUtils.isNull(tokenSecret)) {
      return null;
    }

    OAuth oauth = new OAuth();
    String userName = CacheManager.getStringCacheData(KEY_USER_NAME);
    String userId = CacheManager.getStringCacheData(KEY_USER_ID);
    if (StringUtils.isNotNull(userId)) {
      User user = new User();
      user.setUsername(userName);
      user.setId(userId);
      oauth.setUser(user);
    }

    OAuthToken oauthToken = new OAuthToken();
    oauth.setToken(oauthToken);
    oauthToken.setOauthToken(oauthTokenString);
    oauthToken.setOauthTokenSecret(tokenSecret);
    return oauth;
  }