本文介绍了如何找回栈活动Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个活动回来堆栈中的应用 - 乙 - ç - >ð - > E.现在,在活动E,我想知道,我是从导航后面堆活动。我怎么觉得这??
I have an application with activities back stack A -> B -> C -> D -> E. Now at activity E, I want to know the back stack activities that I navigated from. How do I find this??
推荐答案
的$ C $低于C可用于提取所有的任务和在后面堆栈中每个任务内的顶部的活性
The code below can be used to extract all the tasks and the top activity within each task in the back stack
ActivityManager m = (ActivityManager) ctx.getSystemService( ctx.ACTIVITY_SERVICE );
List<RunningTaskInfo> runningTaskInfoList = m.getRunningTasks(10);
Iterator<RunningTaskInfo> itr = runningTaskInfoList.iterator();
while(itr.hasNext()){
RunningTaskInfo runningTaskInfo = (RunningTaskInfo)itr.next();
int id = runningTaskInfo.id;
CharSequence desc= runningTaskInfo.description;
int numOfActivities = runningTaskInfo.numActivities;
String topActivity = runningTaskInfo.topActivity.getShortClassName();
}
这篇关于如何找回栈活动Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!