You can also extend the MapActivity. Basicly you can extend any of the default activities and views, unless they are marked as "final class", which can't be extended.
MapActivity: http://code.google.com/intl/de/android/reference/com/google/android/maps/MapActivity.html It says "com.google.android.maps public abstract class com.google.android.maps.MapActivity" which means it can be extended. AudioEncoder class: http://code.google.com/intl/de/android/reference/android/media/MediaRecorder.AudioEncoder.html In AudioEncoder it says: android.media public final class android.media.MediaRecorder.AudioEncoder which means, it can't be extended (because it's declared as public final class) On Jan 21, 8:55 pm, Bamboo <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---

