外部浏览器意图,返回键的问题 - 安卓 [英] External browser with intent, back key problem - Android

查看:133
本文介绍了外部浏览器意图,返回键的问题 - 安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个应用程序启动外部浏览器与此code:

I'm working on an app which launches an external browser with this code:

Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl));
startActivity(webIntent);

当用户完成与外部浏览器需要用户返回到主活动。唯一的问题是,当用户presses它启动外部浏览器空白页的背面,因为 startActivity 推出的活动,我似乎没有控制权。

When the user is done with the external browser it takes the user back to the main Activity. The only problem is when the user presses the back it launches the external browser with a blank page, since the startActivity launches an Activity which I seem to have no control over.

怎样使返回键忽略浏览器,或者更重要的是我如何完成活动的webIntent启动?

How do I make the back key ignore the browser, or more importantly how do I finish the activity that the webIntent launches?

推荐答案

HRM我有一个类似的问题最近,也许使用这样的:

Hrm I had a similar problem recently, maybe use something like:

intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP);

intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

也许?

那么明确的顶部标志可能无法正常工作,但看看从最近通话或其他标志的排除。具体FLAG_ACTIVITY_NO_HISTORY。

Well the clear top flag may not work, but look at the exclude from recents or other flags. Specifically FLAG_ACTIVITY_NO_HISTORY.

如果设置,新的活动没有保存在历史堆栈。一旦用户离开它,该活动结束。这也可以设定与noHistory属性

If set, the new activity is not kept in the history stack. As soon as the user navigates away from it, the activity is finished. This may also be set with the noHistory attribute.

这篇关于外部浏览器意图,返回键的问题 - 安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆