
如何将我的Android应用程序恢复到最后的位置,即视图中的活动等?如果我正在显示活动并按下主页按钮,然后再次启动我的应用程序,则返回启动活动.我希望它像iPhone应用程序一样工作,暂停到位并恢复到用户最后的位置.
谢谢.
解决方法:
您可能需要为清单中的根活动设置android:alwaysRetainTaskState =“true”.从文档:
总结Whether or not the state of the task
that the activity is in will always be
maintained by the system — “true” if
it will be, and “false” if the system
is allowed to reset the task to its
initial state in certain situations.
The default value is “false”. This
attribute is meaningful only for the
root activity of a task; it’s ignored
for all other activitIEs.normally,
the system clears a task (removes all
activitIEs from the stack above the
root activity) in certain situations
when the user re-selects that task
from the home screen. Typically, this
is done if the user hasn’t visited the
task for a certain amount of time,
such as 30 minutes.However, when this
attribute is “true”, users will always
return to the task in its last state,
regardless of how they get there. This
is useful, for example, in an
application like the web browser where
there is a lot of state (such as
multiple open tabs) that users would
not like to lose.
以上是内存溢出为你收集整理的如何恢复暂停的Android应用程序(app not Activity)全部内容,希望文章能够帮你解决如何恢复暂停的Android应用程序(app not Activity)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)