I want to log out Twitter. I tried to clear reference and request with a new request URI but my account still login. I read this question but it doesn't describe how to login in detail. How to logout Twitter and login with different account? Could you give me some code for logout or relogin?
The function get requet URI
public static String getRequestURI() {
try {
final Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(Constant.CONSUMER_KEY, Constant.CONSUMER_SECRET);
requestToken = twitter.getOAuthRequestToken(Constant.CALLBACK_URI);
return requestToken.getAuthenticationURL();
} catch (final TwitterException e) {
e.printStackTrace();
}
return "";
}
The function clear reference
public static boolean logout(final Context context) {
getPrefs(context);
CustomSharedPreferences.setPreferences(Constant.ACCESS_TOKEN, "");
CustomSharedPreferences.setPreferences(Constant.ACCESS_TOKEN_SECRET, "");
return true;
}