Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get the OnClick event of Option menu button in Sherlock ActionBar in Android?
    primarykey
    data
    text
    <p>I am working on <strong>Sherlock ActionBar</strong> and using an Option button at right corner, near search icon. I am successful to generate the onClick event for SEARCH button but I am getting problems in onClick event of the option Button. Using the below code to add the buttons :</p> <pre><code>public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { menu.add(0, 1, 1, "Search").setIcon(R.drawable.search_icon).setActionView(R.layout.action_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); menu.add(0, 2, 2, "Button").setIcon(R.drawable.menu_overflow_icon).setActionView(R.layout.action_button).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); } </code></pre> <p>And for click events :</p> <pre><code>@Override public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) { switch (item.getItemId()) { case 1: search = (EditText) item.getActionView(); search.addTextChangedListener(filterTextWatcher); search.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); break; case 2: Toast.makeText(ActivityScreen.this, "hit it", Toast.LENGTH_SHORT).show(); } return super.onOptionsItemSelected(item); } </code></pre> <p>I have shown my requirement in the image attached below. <img src="https://i.stack.imgur.com/6mRwV.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload