Re: [android-developers] Menu throughout Application

2010-02-16 Thread Mark Murphy
Frank Weiss wrote:
> Although Mark's idea is workable, it may be bad OOD. It would work if
> all your apps are direct subclasses of Activity, but what if some are
> MapActivity, etc?

Yup.

:: wishes Java had Ruby's mixin capability for things like this ::

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

Android App Developer Books: http://commonsware.com/books

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


Re: [android-developers] Menu throughout Application

2010-02-16 Thread Frank Weiss
Although Mark's idea is workable, it may be bad OOD. It would work if all
your apps are direct subclasses of Activity, but what if some are
MapActivity, etc? I think the answer may depend on that and how you want to
use the global menu. Using delegation, you could have each menu be created
by the same code, but then what? Typically menus are implemented with inner
classes, allowing access to the Activity's private methods and classes.

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

Re: [android-developers] Menu throughout Application

2010-02-16 Thread Mark Murphy
MobDev wrote:
> Hi,
> 
> I have implemented a Menu within an Activity, but I'd like this Menu
> to exist throughout my whole application...
> How can thsi be achieved ? Should I be placing the
> public boolean onCreateOptionsMenu(Menu menu)
> method within every single Activity or is there some way to "share"
> the menu ?

Use inheritance if you can (implement onCreateOptionsMenu() on some
class and have your other activities inherit from it).

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

Android App Developer Training: http://commonsware.com/training

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


[android-developers] Menu throughout Application

2010-02-16 Thread MobDev
Hi,

I have implemented a Menu within an Activity, but I'd like this Menu
to exist throughout my whole application...
How can thsi be achieved ? Should I be placing the
public boolean onCreateOptionsMenu(Menu menu)
method within every single Activity or is there some way to "share"
the menu ?

Thanks in advance

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