Categories

Which of the following are true about enabling/disabling menu items from an Activity class?

Apr

2

2011

Which of the following are true about enabling/disabling menu items from an Activity class?

Possible answers:

  1. a. onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
  2. b. onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
  3. c. onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
  4. d. onShowMenu can be used to enable/disable some menu items in an Android application.
  5. e. The menu items in an Android application cannot be disabled.

In: Android Asked By: [ Grey Star Level]
Answer #1

Selected answer:

  1. a. onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
  2. b. onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
  3. c. onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
  4. d. onShowMenu can be used to enable/disable some menu items in an Android application.
  5. e. The menu items in an Android application cannot be disabled.

according android.com

Answers Answered By: linked [39 Green Star Level]
Answer #2

Selected answer:

  1. a. onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
  2. b. onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
  3. c. onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
  4. d. onShowMenu can be used to enable/disable some menu items in an Android application.
  5. e. The menu items in an Android application cannot be disabled.

If you want to change the Options Menu any time after it’s first created, you must override the onPrepareOptionsMenu() method. This passes you the Menu object as it currently exists. This is useful if you’d like to remove, add, disable, or enable menu items depending on the current state of your application.

Answers Answered By: jibimary [40 Green Star Level]
Answer #3

Selected answer:

  1. a. onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
  2. b. onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
  3. c. onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
  4. d. onShowMenu can be used to enable/disable some menu items in an Android application.
  5. e. The menu items in an Android application cannot be disabled.

public boolean onPrepareOptionsMenu (Menu menu)

Added in API level 1
Prepare the Screen’s standard options menu to be displayed. This is called right before the menu is shown, every time it is shown. You can use this method to efficiently enable/disable items or otherwise dynamically modify the contents.

Answers Answered By: chetanbhalala [16 Grey Star Level]

Answer this Question

You must be Logged In to post an Answer.

Not a member yet? Sign Up Now »

Valid XHTML 1.0 Transitional

[Valid RSS]