How to bring activity to front?

by mariush » Wed, 14 Apr 2010 14:55:47 GMT


Sponsored Links
 Hi,
Lets suppose that i have an activity A, that activity is moved to
background(function  moveTaskToBack is used), and after while i want
to bring this activity to front again. This code is used:
Activity A = getActivity();
Intent i = new Intent(A, A.getClass());
 i.setAction(Intent.ACTION_MAIN);
 i.addCategory(Intent.CATEGORY_LAUNCHER);
 i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 A.startActivity(i);

Activity is on screen, but when i invoke later moveTaskToBack on A
activity, activity is not moved to backgorund.
Does anyone know why?
Regards
Mariush

--



How to bring activity to front?

by Liviu Ungureanu » Wed, 14 Apr 2010 17:03:53 GMT


 I think you cannot bring an activity to front after the activity called his
onPause() method without actions from user(start your application from menu,
from notification, resume it)  or without starting it from an service.

Maybe someone else know more but if you want to bring your activity to front
try to start it from an service if your application need one or notify the
user via notification and set the pending intent to start your activity.

--


Sponsored Links


How to bring activity to front?

by jpathak » Tue, 04 May 2010 02:43:29 GMT


 Its possible that you don't have the right context. If possible, try
storing the appropriate context in your own activity similar to a
singleton, and then calling startActivity on that context.




--



How to bring activity to front?

by jotobjects » Tue, 04 May 2010 03:55:32 GMT


 What are you trying to accomplish?  Do you expect to make the Activity
disappear and the prior one to appear as if you pressed the BACK key?
I think that is an incorrect understanding.

what parameter do you pass to moveTaskToBack and what is the return
value of the call?




>