Thanks Mark, is there a way to do this for example with MapActivities
as well?

On Jan 21, 5:34 pm, Mark Murphy <[email protected]> wrote:
> Bamboo wrote:
> > I have an application that is composed of multiple activities. Is it
> > possible to override the menu button or the trackball button so that
> > when they are pressed I can display a dialog on the screen irrelevent
> > of which activity I am in?
>
> > I know this would be possible by adding the same code (below) into
> > each of the activities but was wondering if there was a way of
> > handling this event only once?
>
> > @Override
> >    public boolean onCreateOptionsMenu(Menu menu) {
> >            //Add menu items
> >    }
>
> >   �...@override
> >    public boolean onOptionsItemSelected(MenuItem item) {
> >            return true;
> >    }
>
> Create a subclass of Activity that implements the desired logic, then
> have your regular activities extend that subclass.
>
> > Also does anyone know if it's possible to override the home button?
>
> No, it is not possible.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
>
> Android Training on the Ranch! -- Mar 16-20, 
> 2009http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to