I want to show the option menu on the longclick of any listitems as well as it should be shown automatically in开发者_如何学Python the case of multiple selection from the listview.
If I understand the question correctly, all you should have to do is set a listener and call the openOptionsMenu method.
getListView().setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
YourActivity.this.openOptionsMenu();
return true;
}
});
You should familiarize yourself with the methods available to View and Activity.
精彩评论