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. Rendering problems with an Activity having android:screenOrientation="landscape"

Hash: SHA1


I have a regular list with a list of names. When I pick one name, I
need to show it on the screen with the largest font size (they are
supposed to be made available for reading by the phone owner to other
people). On this purpose, I activate a new Activity that declares
android:screenOrientation="landscape" so it can take advantage of the
wider screen available. The Activity has also the FullScreen style.

It works, but for a couple of rendering details. First, the "slide in
screen" effect that I've configured on my Droid doesn't work - the
activity is rendered without any effect. Second, for a glimpse there
are foreign contents on the screen (they are parts of the last
notification screen that I opened). I presume it's a problem of the
frame buffer off-screen contents being not properly managed. If the
problem is not clear, I can later post a link to a short video.

If I start with the regular list already in landscape mode (because I
rotated the phone) everything works fine. The problem seems to be
transitioning from an activity in portrait mode directly to an
activity in landscape mode.
I guess I've hit a known bug...

I was thinking of trying the following thing:

1. Drop the android:screenOrientation="landscape" setting in the
2. Keep the widgets on the Activity initially not visible, so a blank
activity slides in.
3. After a short delay, programmatically switching to landscape mode
and set the widgets visible
4. When quitting the activity, run the reverse steps (setting the
widgets to not visible, programmatically switching to portrait mode,
waiting for a short delay, finishing).

Thoughts? Better workarounds? Thanks.

- -- 
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere." -
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla -



2. How to invoke another application on a Button Click?

-     How do we invoke another application installed in the device?
-     How to invoke the browser on a url link click?

Thank you..



3. Changing the arrow image in ExpandableListActivity

4. How the Activity updated in Pause State.

5. Modifying sensors.c, rebild, and test


7. Intellectual Property