Question

Working on Worklight project for Android platform. Wondering is there any way to override WL.OptionsMenu.addItem?

This is not to hide settings option menu. From Android SDK 11, option menu will be replaced with action bar. In full screen of WebView there is no way to show action bar. In this mobile app, implemented sliding menu. Each time invoke WL.OptionsMenu.addItem will add a menu item in sliding menu.

Thanks

Was it helpful?

Solution

Based on your edit:
Worklight does not yet support the ActionBar in Android, so oddities can happen when using the WL.OptionsMenu API in conjunction with API Level 11 in Android.


Can you explain what you're trying to accomplish? What does "overriding" an item mean in your case?
This is the WL.OptionsMenu API, you can do whatever you want in its limits.

If you mean that you'd like to simply remove the default "Worklight Settings" item, then you need to set worklightSettings to 'false' in application-descriptor.xml. After that, you can simply initialize the OptionsMenu and add any items you need to it.

If you mean that you have an existing item you would like to change, since you know the item ID, you can simply re-create the item, which essentially overrides what it was previously doing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top