活动叠加

2023-09-05 02:34:30 作者:伪装的微笑

有没有办法调试期间vizualise活动栈,在某个时刻,还是正常运行?

Is there a way to vizualise the activity stack, at some moment during debug, or normal run ?

推荐答案

您可以用活动管理一些有用的信息。

You can get some useful information with the activity manager.

ActivityManager         manager = (ActivityManager)getApplication().getSystemService( Activity.ACTIVITY_SERVICE );

此将告诉你在堆栈的顶部,底部和大小,和说明可能是有用的。你将不得不寻找正在运行的任务,找到当前活动。

This will show you the top, bottom and size of the stack, and description may be useful. You will have to search the running tasks to find the current activity.

RunningTaskInfo         task = manager.getRunningTasks( 10 ).get( 0 );
task.baseActivity();
task.numActivities();
task.topActivity();
task.description();

这有一个pkgLst方法可能会有所帮助。

This has a pkgLst method that may be helpful.

RunningAppProcessInfo   app = manager.getRunningAppProcesses().get( 0 );
app.pkgList();

不一样有用或简单,因为你所期望的,但它可能会有所帮助。

Not as useful or straightforward as you were hoping for, but it might help.

活动提供了getCallingActivity()方法,你可以添加到的onPause和onResume日志的建议了。

Activity provides the getCallingActivity() method that you could add to logs in onPause and onResume as suggested before.

还有如果(isChild())的getParent(); 的嵌入式活动

相关推荐