On Thursday, August 23, 2012 4:12:44 AM UTC+1, MagouyaWare wrote: > > 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<javascript:> > > 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-d...@googlegroups.com<javascript:> >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> >
---------------------- Hi there I tried to understand the log error unfortunately I could not fix the pb. any help, thank you very much here is the log cat ------------ 08-23 01:29:46.499: D/AndroidRuntime(1296): Shutting down VM 08-23 01:29:46.499: W/dalvikvm(1296): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 08-23 01:29:46.508: E/AndroidRuntime(1296): FATAL EXCEPTION: main 08-23 01:29:46.508: E/AndroidRuntime(1296): java.lang.NullPointerException 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.example.context_menu.ContextMenuActivity.onContextItemSelected(ContextMenuActivity.java:50) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.app.Activity.onMenuItemSelected(Activity.java:2199) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2744) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:137) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:874) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.widget.ListView.performItemClick(ListView.java:3382) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.os.Handler.handleCallback(Handler.java:587) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.os.Handler.dispatchMessage(Handler.java:92) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.os.Looper.loop(Looper.java:123) 08-23 01:29:46.508: E/AndroidRuntime(1296): at android.app.ActivityThread.main(ActivityThread.java:4627) 08-23 01:29:46.508: E/AndroidRuntime(1296): at java.lang.reflect.Method.invokeNative(Native Method) 08-23 01:29:46.508: E/AndroidRuntime(1296): at java.lang.reflect.Method.invoke(Method.java:521) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 08-23 01:29:46.508: E/AndroidRuntime(1296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 08-23 01:29:46.508: E/AndroidRuntime(1296): at dalvik.system.NativeStart.main(Native Method) 08-23 01:29:56.129: I/Process(1296): Sending signal. PID: 1296 SIG: 9 08-23 01:30:05.438: D/AndroidRuntime(1304): Shutting down VM 08-23 01:30:05.438: W/dalvikvm(1304): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 08-23 01:30:05.448: E/AndroidRuntime(1304): FATAL EXCEPTION: main 08-23 01:30:05.448: E/AndroidRuntime(1304): java.lang.NullPointerException 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.example.context_menu.ContextMenuActivity.onContextItemSelected(ContextMenuActivity.java:53) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.app.Activity.onMenuItemSelected(Activity.java:2199) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2744) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:137) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:874) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.widget.ListView.performItemClick(ListView.java:3382) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.os.Handler.handleCallback(Handler.java:587) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.os.Handler.dispatchMessage(Handler.java:92) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.os.Looper.loop(Looper.java:123) 08-23 01:30:05.448: E/AndroidRuntime(1304): at android.app.ActivityThread.main(ActivityThread.java:4627) 08-23 01:30:05.448: E/AndroidRuntime(1304): at java.lang.reflect.Method.invokeNative(Native Method) 08-23 01:30:05.448: E/AndroidRuntime(1304): at java.lang.reflect.Method.invoke(Method.java:521) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 08-23 01:30:05.448: E/AndroidRuntime(1304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 08-23 01:30:05.448: E/AndroidRuntime(1304): at dalvik.system.NativeStart.main(Native Method) ----------------------------- -- 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