Android从桌面打开图标,发现是之前未返回的应用的解决方法

如果你的应用打开了其他应用程序的activity(好比浏览一张图片或是选择附件),那么有一个很重要的intent的标志需要了解:

Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

如果不想让用户在Launcher或是桌面的快捷方式上重新打开你的应用时,再返回到你将要打开的其他程序的activity,就要使用这个标志。

例如:点击的是Gmail的图标,打开的却是选择图片的界面,因为这是你之前使用Gamil时的最后的操作,这会让人觉得很怪。

这个标志不会影响最近使用的程序列表或是后退按钮的功能,用户依然可以通过最近的程序列表返回到离开你应用时的状态。


原文:

If your application launches the activities of other applications (such as to view a picture or pick an attachment), there is an important intent flag to know:


Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

Use this when starting an activity that you don't want the user to return to if they relaunch your application from the app launcher or a shortcut on the home screen. For example, it would be confusing to tap on the Gmail icon and find yourself selecting a picture because that is the last thing you had been doing as part of the Gmail task.

This flag doesn't impact how switching between recents or using the back button works, so the user can still return to your app in exactly the same state they left it by going through recents.


http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值