首页 > 其他 > 详细

Intent的几种Flag的不同

时间:2016-01-22 10:47:33      阅读:166      评论:0      收藏:0      [点我收藏+]

冬天有点冷,不想写博客。

研究下Intent的几种Flag的不同:

1,FLAG_ACTIVITY_CLEAR_TOP:会清理掉目标activity栈上面所有的activity

Intent intent = new Intent(this, B.class);    
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);   
startActivity(intent);

2,FLAG_ACTIVITY_BROUGHT_TO_FRONT:创建目标activity,且位于栈顶

Intent intent = new Intent(this, B.class);    
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);   
startActivity(intent);

3,FLAG_ACTIVITY_REORDER_TO_FRONT:如果目标activity存在栈中,将其置顶

Intent intent = new Intent(this, B.class);    
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);   
startActivity(intent);

4,FLAG_ACTIVITY_NEW_TASK:创建新的activity实例

Intent intent = new Intent(this, B.class);    
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);   
startActivity(intent);

 

Intent的几种Flag的不同

原文:http://www.cnblogs.com/androidsuperman/p/5150250.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!