List<ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(1);
ComponentName componentInfo = taskInfo.get(0).topActivity;
componentInfo.getPackageName();
activity = taskInfo.get(0).topActivity.getClassName();
packagename = componentInfo.getPackageName();
I have this code to get the running activity and package names. My question is:
This package contains another class (Name.java), which is not an activity and returns a String Value that I also need to get.
Is this possible with the ActivityManager?
To be more clear:
the home activity is a screen with a list of items. by sliding to the right or to the left, the screen changes and displays, for example, favorite items, rated items etc. each of those screens/views have a name (Name.java handles it). What I want to do is, to get the name of the current view also, not just the name of the Activity.
No, you can’t get this information using the ActivityManager. The ActivityManager will only give you information about Android components (Activity, Service, BroadcastReceiver, ContentProvider) and their configuration. You can’t access random Java classes within other packages.