i want to bring my application to foreground when it goes to background.
when my application is in the foreground then on the button click i set the 
taskid in a variable(id)with below code

    ActivityManager am = (ActivityManager) 
this.getSystemService(ACTIVITY_SERVICE);
    RunningTaskInfo foregroundTaskInfo = am.getRunningTasks(1).get(0);
    id = foregroundTaskInfo.id;

and when my activity goes to background then on pause method work and in 
the onpause i use the below code to bring our application to foreground.

    ActivityManager am = (ActivityManager) 
this.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
    am.moveTaskToFront(id, ActivityManager.MOVE_TASK_NO_USER_ACTION);

but it does not work..

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to