Take a look at the logcat output... What do you see? It should give you the reason for the crash as well as a stack trace that often points the exact file and line number that is the cause.
Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Wed, Aug 22, 2012 at 8:05 PM, Jegadeesan M <jeg...@gmail.com> wrote: > please check this link : > http://grepsrc.com/search?q=Contextmenu&defs=&refs=&path=&hist=&project=ics-mr1 > > > On Wednesday, 22 August 2012 18:46:50 UTC-7, aek wrote: >> >> >> >> Hi there, >> I wrote this short android program, however I am geting a problem. When >> the context menu appears and I click for instance >> on one of its items such as "Edit" or "Delete". a system pop up alert >> info arise saying that the process stoped unexpectedly. >> I tried different strategy to solve but unfortunately it is fruitless. >> >> Thanks for your help. >> >> abdelkader >> >> -----------------------------**---------- >> package com.example.context_menu; >> >> import android.os.Bundle; >> import android.app.Activity; >> import android.app.ListActivity; >> import android.view.ContextMenu; >> import android.view.ContextMenu.**ContextMenuInfo; >> import android.view.Menu; >> import android.view.MenuItem; >> import android.view.View; >> import android.widget.AdapterView.**AdapterContextMenuInfo; >> import android.widget.ArrayAdapter; >> import android.widget.ListView; >> import android.widget.Toast; >> import android.support.v4.app.**NavUtils; >> >> >> >> public class ContextMenuActivity extends Activity { >> >> >> final int EDIT_ID = 0, DELETE_ID = 1; >> >> @Override >> public void onCreate(Bundle savedInstanceState) { >> super.onCreate(**savedInstanceState); >> setContentView(R.layout.**activity_context_menu); >> >> registerForContextMenu(**findViewById(R.id.textView1)); >> >> } >> >> public void onCreateContextMenu(**ContextMenu menu, View v, >> ContextMenuInfo menuInfo) { >> super.onCreateContextMenu(**menu, v, menuInfo); >> menu.add(0, EDIT_ID, 0, "Edit"); >> menu.add(0, DELETE_ID, 0, "Delete"); >> >> >> } >> >> public boolean onContextItemSelected(MenuItem item) { >> AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); >> switch (item.getItemId()) { >> case EDIT_ID: >> editNote(info.id); >> return true; >> case DELETE_ID: >> deleteNote(info.id); >> return true; >> default: >> return super.onContextItemSelected(**item); >> } >> } >> >> public void editNote(long x){ >> Toast.makeText(**getApplicationContext(), "hello" + x, >> Toast.LENGTH_LONG).show(); >> } >> >> public void deleteNote(long x){ >> Toast.makeText(**getApplicationContext(), "hello" + x, >> Toast.LENGTH_LONG).show(); >> >> } >> >> @Override >> public boolean onCreateOptionsMenu(Menu menu) { >> getMenuInflater().inflate(R.**menu.activity_context_menu, menu); >> return true; >> } >> >> >> } >> >> -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en