On Wed, Oct 13, 2010 at 7:16 AM, Hatch <[email protected]> wrote:
> I have a toolbar view set for most of my activities.
>
> The toolbar has several buttons which all trigger certain intents.
> Now, the problem is:
> how can I close current activity before starting another one ?
>
> Problem 1) Activity cones
> For instance one of the buttons ('A') starts activity A.
> Activity A also has toolbar.
> If you press on the 'A' button, a new A activity will be started.

Disable that toolbar button. Or, remove that toolbar button. Or, on a
click of that toolbar button, see that you are are an instance of
Activity A and ignore the click.

> I suppose I can look at Activity.getInstanceCount(), right ?

I seem to recall that this is unreliable.

> Problem 2) Unnecessary activities
> The activity X is not needed any more if the opts for A. I just want A
> then.
> How can I remove X from toolbar which only has access to context ?

Your toolbar is some sort of ViewGroup. Call removeView() on the
toolbar to get rid of your button.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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

Reply via email to