How to bring activity to front?

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

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

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


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?


Other Threads

1. How to custom option menu to arrange three menu items where 2 menu items are displayed at the top and the third below it.

Can't do it. The OS arranges menu items as it pleases. For 3 items,
the arrangement is all on one line.

If you want different, you'll need to build your own menu-simulation
class - which isn't actually that hard, using the standard Android
layout widgets.



2. OOT - Breaking News, Sri Mulyani batal gabung ke World Bank !!!

Ternyata Sri Mulyani ga jadi bergabung ke World Bank
Info lebih jelas silakan cek di

"Indonesian Android Community [id-android]" 

3. Akhirnya T3 mengakui

4. Wtc macam2 ,gadget & accessories..

5. Dual screen support on Android 2.1 emulator

6. Screen off suspends the Thread

7. How to fix "java.lang.IllegalThreadStateExeception: Thread already started."