function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Android UserAndroid User 

How to remove menu option

From android native app login page using SalesforceSDK how can i hide/remove menu option.
I want to restict users they should not change server url.
Best Answer chosen by Android User
Deepali KulshresthaDeepali Kulshrestha
Hi Android User,

Get a MenuItem pointing to such item, call setVisible on it to adjust its visibility and then call invalidateOptionsMenu() on your activity so the ActionBar menu is adjusted accordingly.

Update: A MenuItem is not a regular view that's part of your layout. Its something special, completely different. Your code returns null for item and that's causing the crash. What you need instead is to do:

For more visit this link,it will help you:

https://stackoverflow.com/questions/10692755/how-do-i-hide-a-menu-item-in-the-actionbar

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha