如何prevent活动重装背行动 [英] How to prevent activity to reload on back action
本文介绍了如何prevent活动重装背行动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序,连接到互联网来获取数据。我可以访问数据的多层次的。
I have app that connects to internet to get data. I can access data multi-level.
因此,让我们说,我开始在3级和4级我决定回去了,每当我preSS回previous活动从互联网上重新加载数据。
So let say I start at level 3 and on level 4 I decide to go back, whenever I press back the previous activity reloads the data from the internet.
是否有可能以prevent呢?
Is there any possibility to prevent that?
我试图运行在单一机顶模式的活动。
I have tried to run the activity in single-top mode.
推荐答案
将数据加载code到单EXEC事件:ONSTART或
Move the data loading code to the single-exec event: onStart or
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(savedInstanceState == null) {
// here
}
}
这篇关于如何prevent活动重装背行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文