Activity之isTaskRoot和moveTaskToBack方法简介
2016-05-06 18:57
435 查看
1、public boolean isTaskRoot()用来判断该Activity是否为任务栈中的根Activity,即启动应用的第一个Activity
2、public boolean moveTaskToBack (boolean
nonRoot)用于将activity退到后台,不是finish
从生命周期来说,会执行onPause、onStop,但不会执行onDestroy
恢复的时候也一样,会执行onStart、onResume,但不会执行onCreate
参数nonRoot表示的含义是此方法对非根activity是否有效,也就是说true表示对所有activity均有效,false表示只对根activity有效。
返回值:该activity被退出到后台或者他已经在后台了返回true,否则返回false
官方文档:
public boolean moveTaskToBack (boolean nonRoot)
Since: API Level 1Move the task containing this activity to the back of the activity stack. The activity's order within the task is unchanged.
Parameters
nonRoot If false then this only works if the activity is the root of a task; if true it will work for any activity in a task.
Returns
If the task was moved (or it was already at the back) true is returned, else false.
2、public boolean moveTaskToBack (boolean
nonRoot)用于将activity退到后台,不是finish
从生命周期来说,会执行onPause、onStop,但不会执行onDestroy
恢复的时候也一样,会执行onStart、onResume,但不会执行onCreate
参数nonRoot表示的含义是此方法对非根activity是否有效,也就是说true表示对所有activity均有效,false表示只对根activity有效。
返回值:该activity被退出到后台或者他已经在后台了返回true,否则返回false
官方文档:
public boolean moveTaskToBack (boolean nonRoot)
Since: API Level 1Move the task containing this activity to the back of the activity stack. The activity's order within the task is unchanged.
Parameters
nonRoot If false then this only works if the activity is the root of a task; if true it will work for any activity in a task.
Returns
If the task was moved (or it was already at the back) true is returned, else false.
相关文章推荐
- 【偶遇的知识点】rem
- SQL Server 数据库创建
- Highcharts一些属性
- 20145312 《Java程序设计》第十周学习总结
- [BS-13] 创建和注册UITableViewCell及Storyboard和Xib区别
- linux常用shell命令
- JAVA——TCP传输
- spring自动扫描机制
- mysql存储过程调试学习总结
- 机器学习算法---kNN算法
- linux常用网络命令
- linux基础之常用命令(4)
- codeforces 659E New Reform
- CTSC2016游记
- windows下安装python科学计算环境,numpy scipy scikit ,matplotlib等
- Codeforces Round #350 (Div. 2)_D2 - Magic Powder - 2
- Codeforces Round #350 (Div. 2)_D2 - Magic Powder - 2
- Asp.net 面向接口可扩展框架之“Mvc扩展框架及DI”
- ok6410 3.0.1内核调用V4L接口出错解决方法(转)
- RBM Formula Deduction