Friday , October 19 2018
Home / Android / Context Menu In Android

Context Menu In Android

This tutorial explains about creating Context menu in Android.A context menu provides actions that affect a specific item or context frame in the UI.

Context Menu appears when user long press on a View like ListView, GridView etc.It doesn’t support item shortcuts and icons.

Android Context Menu Example

activity_main.xml

Drag one listview from the pallete, now the xml file will look like this:

File: activity_main.xml

Activity class

Let’s write the code to display the context menu on press of the listview.

File: MainActivity.java

Preview

context

About admin

Check Also

Android Activity Launch Modes

Launch mode is an instruction for Android OS which specifies how the activity should be ...

Leave a Reply