Hello,
How would I go about using the Twitter.logIn (Javadocs info: https://docs.fabric.io/javadocs/twitter/2.3.2/index.html method to allow a User to log into Twitter while the User is already using the app as a Guest or perhaps they just logged out of their Twitter account and want to log back in. I dont want to send them back to the login page (AKA the login activity example found on the Fabric website)
Lets say for example I have an Activity called Tweet_Fragments.java that displays a list of Tweets.
And in the ActionMenu I have a “Login” Button because the User is in Guest-Mode or User just Logged out of their Twitter Account and would now like to log back in.
So say I have a piece of code in my Activity such as
if (id == R.id.tw_login_button){
Twitter.logIn(Tweet_Fragments.this, new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
final Intent intent = new Intent(this, Tweet_Fragments.class);
startActivity(intent);
}
@Override
public void failure(TwitterException exception) {
Toast.makeText(this, "Failed to login to Twitter", Toast.LENGTH_LONG).show();
}
});
This line
(this, Tweet_Fragments.class)
Throws the Error:
Cannot resolve constructor 'Intent(anonymous com.twitter.sdk.android.core.Callback<com.twitter.sdk.android.core.TwitterSession>, java.lang.Class<com.example.android.project.Tweet_Fragments>)'
And this line
(this, "Failed to login to Twitter", Toast.LENGTH_LONG)
Throws the Error
Cannot resolve method 'makeText(anonymous com.twitter.sdk.android.core.Callback<com.twitter.sdk.android.core.TwitterSession>, java.lang.String, int)'
Are there any code examples the Twitter Developers can share on using the Twitter.logIn method?