我已经在我的应用程序中集成了Twitter登录,使用了Fabric(从Fabric插件中复制了代码)。它工作正常,但每次出现此屏幕时:
我怎么能摆脱这个? 这是我使用的代码:
登录片段:
private void onTwitterLogin() {
twitterlogin.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
session = result.data;
auth_token = session.getAuthToken();
Twitter.getApiClient(session).getAccountService()
.verifyCredentials(true, false, new Callback<com.twitter.sdk.android.core.models.User>() {
@Override
public void failure(TwitterException e) {
}
@Override
public void success(Result<com.twitter.sdk.android.core.models.User> userResult) {
com.twitter.sdk.android.core.models.User tUser = userResult.data;
String twitterImage = tUser.profileImageUrl;
username = tUser.screenName;
name = tUser.name;
new TwitterLoginTask().execute(username, name, social_type);
}
});
}
@Override
public void failure(TwitterException exception) {
Toast.makeText(getActivity(), "You don't have Twitter application \ninstalled in your device", Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
twitterlogin.onActivityResult(requestCode, resultCode, data);
}
MainActivity:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
FragmentManager fragment = getSupportFragmentManager();
if (fragment != null) {fragment.findFragmentByTag("LoginFragment").onActivityResult(requestCode, resultCode, data);
}
}