Search code examples
android-optionsmenu

Display options menu using onClickListener


I was just wondering whether it is possible to display my options menu to be displayed when I click on a image. Now I have displayed my options menu when the menu button is clicked. But I would like to display it when the user clicks on my imageView too. Is this possible?


Solution

  • I found this to be so simple at last.

    imageView.setOnClickListener(new OnClickListener() {
    
            public void onClick(View v) {
            openOptionsMenu();
            }
        });