3

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?

Andro Selva
  • 53,910
  • 52
  • 193
  • 240

1 Answers1

3

I found this to be so simple at last.

imageView.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
        openOptionsMenu();
        }
    });
Andro Selva
  • 53,910
  • 52
  • 193
  • 240
  • I just found this and it worked out perfectly. I use ActionBarSherlock and the Compatibility Library and needed a universal way to open a menu on all versions of Android from an ImageView. I didn't think there would be a solution, but this worked flawlessly. Upvotes all around. – Davek804 May 08 '12 at 04:29
  • Any time! You're the second person in Chennai to have helped me with this app. Much appreciated and cheers from the US! If you care to see how I implemented this, take a look here: http://stackoverflow.com/q/10491495/1231943 and here: http://stackoverflow.com/q/10491071/1231943 – Davek804 May 08 '12 at 04:35