I want to catch an event when spinner drop down is dismissed. We can catch it when the user clicks on any item in the onItemSelected(). But I want to catch even when user touches outside of the drop down area or back button as these too make it disappear. In these two causes when I observed log, it says "Attempted to finish an input event, but the input event receiver has already been disposed"
I observed the source code, this is printed from the InputEventReceiver.java in the finishInputEvent(InputEvent event, boolean handled) method. But it's a final method, so there is no point of overriding it. Can some one please suggest the way to handle when the drop down is dismissed in those cases?
I have used Popup Menu
instead of Spinner. Because as far as my knowledge, dismiss event couldn't be caught with spinner, but with Popup menu I did it by setting onDismissListerner()
to the popup menu
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
Toast.makeText(MyActivity.this,"Clicked on: " + item.getTitle(),Toast.LENGTH_LONG).show();
return true;
}
});
popup.setOnDismissListener (new PopupMenu.OnDismissListener(){
public void onDismiss()
{
//catch dismiss event here.
}
});