tags:

views:

119

answers:

3
+6  Q: 

activities stack

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

A: 

Not that I am aware of. For within your own application, you can track this yourself by pushing yourself onto your own stack data structure in onResume() and popping yourself off of that stack in onPause().

CommonsWare
A: 

There is no direct way i think, but a way is to put logs in all call backs lik on create/pause/resume/destroy/etc and see the calls(Ex:Log.d()).

Kantesh
+1  A: 

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();

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.

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

There is also if ( isChild() ) getParent(); for embedded activities.

drawnonward