Context menu in android is a type used to open a android popup menu when a Long Click is made on list-view. A menu pop’s up giving options like share, delete, edit,etc,.

Generally used with listview to populate further more options which cannot be displayed there on the list.This types of list menu are much flexible in using and also gives a comfort in design purpose too.

In this tutorial i will be showing you android menu example based on the android context menu  with five different options.

Inserting values into String [ ] and showing these values in list-view, and by long click on this  values you can get a options menu.

In this context menu i am adding five options like share, view, update, delete, delete all


Declaring a String array with dummy values as


And passing the above values on to the list adapter and then registering our context menu on the listview as


After a long press on the particular item and selecting the option we can return selected value and process it.


Adding Listview and text view to the xml file.









If you have any query’s in this tutorial let me know through comments below.

Like and share our this tutorial if you like it

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial on SplashScreen