Urgent Help on Single instance of the activity

10 views
Skip to first unread message

Revathi K J Ramanan

unread,
Sep 7, 2010, 6:53:34 AM9/7/10
to CodeAndroid Developers Group
Hi,

I have two activities.A and B.
A starts B.Both are running in the screen and both are visible. Say
now B is visible.

On a special key press, I want to bring the A to the front and make it
active.
The problem I am facing is when the special key is pressed, another
instance of A is launched and the new instance is brought to the
front.

But I want the original A to come to the front. I want to make this
change in the framework layer rather than application specific by
using the singleInstance theme in the launchMode in AndroidManifest
file.

Please help me in this regard as this is really urgent for me.
Any inputs will be really valuable for me.

Thanks in advance.

Regards,
Revathi K J Ramanan

Bharathi Subramanian

unread,
Sep 7, 2010, 11:43:26 PM9/7/10
to wecode...@googlegroups.com
On Tue, Sep 7, 2010 at 6:53 PM, Revathi K J Ramanan wrote:

> I have two activities.A and B. A starts B. Both are running in the


> screen and both are visible. Say now B is visible.

At any point, more then one 1 activity cannot occupy the screen.

> But I want the original A to come to the front. I want to make this
> change in the framework layer rather than application specific by
> using the singleInstance theme in the launchMode in AndroidManifest
> file.

If you don't know, how solve this at application level then don't
change framework. Just try this:

1st A is running. Now call B. Once the operation is over at B, just
destroy B (Here don't forget to save the states in OnPause). You will
get back the same A. Otherwise if you cyclically call A and B, it will
simply pileup instances in the activity stack.

> Please help me in this regard as this is really urgent for me.

Public mailing list is not help desk. So don't send urgent message to
it. That is a very bad netiquette.

Bye :)
--
Bharathi Subramanian

Revathi K J Ramanan

unread,
Sep 8, 2010, 12:05:09 AM9/8/10
to wecode...@googlegroups.com
Hi Bharathi,

Thanks for the immediate response.

I have made changes in the framework that more than one activity is visible in the screen with reduced size.

And I wan the MS Windows concept of activating a window that is visible at the back to come to front on mouse click.

I dont want another instance of the activity to get created.
I want the activity that is at the back to come to the front and get the focus.

I tried with the single instance launch mode and the intent flag, FLAG_ACTIVITY_REORDER_TO_FRONT.
But it not helping me and every other time I click the back activity, one more instance is coming to the front.

Regards,
Revathi


--
You received this message because you are subscribed to the Google Groups "CodeAndroid Developers Group" group.
To post to this group, send email to WeCode...@googlegroups.com.
To unsubscribe from this group, send email to WeCodeAndroi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/WeCodeAndroid?hl=en.


Reply all
Reply to author
Forward
0 new messages