调试程序时,遇到一个问题:先启动程序A,然后Home挂起到后台,然后启动程序B,在B中通过sendBroadcast启动程序A的一个Activity(A中有个receiver,来接收广播,然后启动activity/使用了New_TASK flag),问题出现了,这个Acitivty结束时,不是返回B,而是返回先前挂起的A。
解决方法:setActivity时设置flag:NEW_TASK|MULTIPLE_TASK
MULTIPLE_TASK: used in conjunction with FLAG_ACTIVITY_NEW_TASK to disable the behaviror of bringing an existing task to thre forgefround. When set, a new task is always started to host the Activity for the Intent, regardless of whether there is already an existing task running the same thing.
阅读(2800) | 评论(0) | 转发(0) |