I used ActionBarSherlock to create ActionBar
it has a search button that shows an AutoCompleteEditText
(SHOW_AS_COLLAPSIBLE_ACTION_VIEW
)
When Searc
If you still have the problem, so call the following method
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
instead of
imm.showSoftInput(searchBar, InputMethodManager.SHOW_IMPLICIT);
Found the Solution:
searchWidgetItem.setOnActionExpandListener(new OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
searchBar.post(new Runnable() {
@Override
public void run() {
searchBar.requestFocus();
imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(searchBar,
InputMethodManager.SHOW_IMPLICIT);
}
});
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
return true;
}
});