On Sun, Nov 20, 2011 at 12:14 AM, limtc <[email protected]> wrote:
> I have a menu item in menu.xml that allows user to click and use
> camera.
>
> Since now there are more devices without camera (Kindle Fire, etc),
> would like to remove menu (or disable it) if no camera detected. Has
> anybody done this before?

What is "this"?

If "this" is detect whether there is a camera, between PackageManager
and hasSystemFeature() and the Camera class on API Level 9+, you have
options for detecting it.

If "this" is disable or remove a menu item, just find the MenuItem by
ID from your Menu and call the appropriate setter (e.g.,
setEnabled()). Until such time as we have to worry about cameras
coming and going, you could just do this as part of our
onCreateOptionsMenu() logic.

If "this" is something else, use fewer pronouns. :-)

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