Introduction
If you have been writing software applications for a while, I am sure you are familiar with context menus. A context menu is a list of action items popup when you right click on a screen in an application.
In an Android phone, if we
long touch EditText, it will open a list of items and when you click on these items, there are some actions corresponding to them. This is known as a Context Menu in
Android. Context Menu is generally helpful while you want to give some specific
additional functionality to your Views. Views are nothing but application's
EditText, Buttons etc.
In this step by step tutorial, we will see how to build a context menu based Android application.
Step 1:
Create "mymenu.xml"
Right Click "your project" -> new -> Android
XML file

Step 2:
Edit your "mymenu.xml" file
- <?xml version="1.0" encoding="utf-8"?>
- <menu
- xmlns:android="http://schemas.android.com/apk/res/android">
- <group android:checkableBehavior="single">
- <item android:id="@+id/CutText" android:title="Cut"></item>
- <item android:id="@+id/CopyText" android:title="Copy"></item>
- <item android:id="@+id/PasteText" android:title="Paste"></item>
- </group>
- </menu>
Step 3:
Edit your "ContextMenu.java" file
Before start editing, let's have a look at the Context menu work. A context menu generally works on a View. For that, first, we need to "register" our view (or views) that will display the Context Menu on long touch.
This is done by using "registerForContextMenu".
It takes a View as an
argument.
- import android.view.ContextMenu;
- import android.view.ContextMenu.ContextMenuInfo;
Used to
Additional information regarding the creation
of the context menu
CContextMenu.java




Chintan RathodPosted Sep 10, 2012, 6:32 AM
Sorry my friend. Derby can't be used in Android Application. Here is the link --> https://issues.apache.org/jira/browse/DERBY-4458 . You can read whole issue given in Apache.
Albin RatheeshPosted Sep 10, 2012, 2:49 AM
very use full tutorial for all programming languages.MR.Chintan can i connect Apache Derby DataBase with Android Application.
Abhi KumarPosted Dec 24, 2011, 12:40 AM
Very useful article. Thanks for sharing.
Jimmy UnderwoodPosted Dec 23, 2011, 11:58 PM
Thanks for sharing
Animesh LakkarPosted Dec 23, 2011, 11:56 PM
Mr.Chintan you have provided a helpful info about the context menu