I want to start the foreground work. And I can get this information using the activity manager using the following code.
activityManager = (ActivityManager) FWCommon.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE); runningTaskInfoList = activityManager.getRunningTasks(1); componentName = runningTaskInfoList.get(0).topActivity;
Suppose I have two actions A and B, and I call this code from onResume () above for both actions A and B.
Below is the problem
- When action A starts with the code above, I'm assigned topActivity = A
- Then I go from actions A to B and the above code gives me topActivity = B
- Then I press "Back" to return from action "B" to "A" and "above" the code again gives me topActivity = B instead of A.
thanks Dalvin
source share