Opening and Closing Menu Programmatically

API for opening menu programmatically is openOptionsMenu(). If we are in a different context, then we can use this method by,

((Activity) mContext).openOptionsMenu();

For closing menu programmatically, if it opens use this,

((Activity) mContext).closeOptionsMenu();


Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android