如何发送我的活动背景和简历? [英] How to send my activity to background and resume?
问题描述
我想从互联网加载数据。
I want to load data from Internet.
在加载数据I显示加载指示器。我想在pressing回来,我取消通过 onCancelEvent负载指示做什么()
。我要在活动中的背景继续,这样最后活性示于前面。
While loading data I show a loading indicator. What I want to do when pressing back, I cancel the loading indicator via onCancelEvent()
. I want to my activity to continue in background, so that the last activity is shown to front.
我不想结束(),并开始为所有的数据显示在该最后一个活动,这将再次加载如果重新创建。
I don't want to finish() and start the last activity as all the data is shown in that, which will be loaded again if recreated.
任何一个可以帮助?
推荐答案
基本上你想切换当前背景和previous背景的顺序。要做到这一点,你就可以开始了previous活动,并使用FLAG_ACTIVITY_REORDER_TO_FRONT标志:
Basically you want to switch the order of the current background and the previous background. To do this, you can start the previous activity and use the FLAG_ACTIVITY_REORDER_TO_FRONT flag:
Intent intent = new Intent(this, MyPreviousActivity.class);
intent.setFlags(FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
所以,如果你有任务A,B,C和任务的C调用startActivity()与活动B,那么B就会被带到活动堆栈的前面,所产生的顺序A,C,B,这是什么你问了。
So if you have tasks A, B, C and task C calls startActivity() with activity B, then B will be brought to the front of the activity stack, with the resulting order A, C, B, which is what you were asking for.
请参阅<一href="http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT"相对=nofollow> Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
这篇关于如何发送我的活动背景和简历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!