context menu in android studio example

Hello Guys. Welcome to our new tutorial of the context menu in android studio example. Here we will teach you the Android Context Menu Example.

android context menu appears for long pressing on the element. its also call ass floating menu.

please follow the code given below to use Android Context Menu Example

  • First Create a new project in Android Studio
  • File ⇒ New Android ⇒ Application Project
  • Then Open src -> package -> MainActivity.java and then add following code :

JAVA (MainActivity.java)

  •  Now Open res -> layout -> activity_main.xml and then add following code :

XML (activity_main.xml)

Output:

Finally, run this project.

This is how the context menu in android looks like

context menu in android context menu in android

Leave a Reply

Your email address will not be published. Required fields are marked *