Creating a context menu

To create a context menu:

Register the View to which the context menu should be associated by
calling registerForContextMenu() and pass
it the View. Here we have used Context Menu with ListView

Implement the onCreateContextMenu() method
in your Activity
When the registered view receives a long-click event, the system calls your onCreateContextMenu()method. This is where you define the menu items, usually by inflating a menu resource.

I really enjoyed reading your article. I found this as an informative and interesting post, so I think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.