0
我试图将Twitter集成到我的应用程序中(即使您从未这样做过,请继续阅读)。这是登录流程:活动打开外部应用程序,打开活动,从而使其在活动堆栈中翻倍
- 用户点击活动
- Twitter的认证网站在浏览器中出现“与Twitter登录”。用户点击允许应用使用Twitter
- 浏览器消失,活动再次打开。
问题是,活动打开AGAIN,这意味着点击后我仍然在这个活动(就在用Twitter登录之前),所以我需要再次单击BACK。
这是打开Twitter的授权网站在浏览器中的行:
SettingsActivity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL())));
把finish()
后,它并不能帮助。
甚至没有设置FLAG_ACTIVITY_CLEAR_TOP:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(requestToken.getAuthenticationURL()));
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
任何想法?