Remove All Ads from XDA

[Q] How to dismiss contextual action bar programmatically

1,158 posts
Thanks Meter: 630
Post Reply Email Thread
I am using contextual action bar for lisview check box.I want to dismiss it programmatically to ensure that it is hidden if no check box is selected. [/code]private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
// called when the action mode is created; startActionMode() was called
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
// Inflate a menu resource providing context menu items
MenuInflater inflater = mode.getMenuInflater();
// assumes that you have "contexual.xml" menu resources
inflater.inflate(, menu);
return true;
// the following method is called each time
// the action mode is shown. Always called after
// onCreateActionMode, but
// may be called multiple times if the mode is invalidated.
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false; // Return false if nothing is done
// called when the user selects a contextual menu item
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
// the Action was executed, close the CAB

return true;
default :
return false;
// called when the user exits the action mode
public void onDestroyActionMode(ActionMode mode) {
mActionMode = null;
loadlist(new File(prog.getText().toString()));

I am using it like this
mActionMode = getActivity().startActionMode(mActionModeCallback);
Where mActionMode is object(Universal)
I have tried mActionMode=null; or mActionMode.finish() etc.

Sent from my GT-S5570 using XDA Premium 4 mobile app
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes