I viewed the DDMS and it started with "thread exiting with uncaught exception" message. and then it shows that the error was caused by toast activity. I tried to write only log.d output, and it works. I tried another activity (receiver intent), and it also crash.
Is this related to uncaught exception or the context parameter in the activity, or something else? Thanks On Mar 18, 12:59 am, Mark Murphy <[email protected]> wrote: > ccal wrote: > > I tried it, but it didn't work. now it crashes if i select the option > > ("application XXX has stopped unexpectedly" message pops up). > > Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine the > Java stack trace associated with your crash. This will help you pinpoint > your problem. > > > > > Can you tell me where did I go wrong? > > This is how I implement it (the code below). > > > Thanks > > > public void onCreateContextMenu(ContextMenu menu, View v, > > ContextMenu.ContextMenuInfo menuInfo){ > > super.onCreateContextMenu(menu, v, menuInfo); > > MenuItem addItem = menu.add("the custom menu"); > > addItem.setOnMenuItemClickListener(custommenu); > > > } > > > private MenuItem.OnMenuItemClickListener custommenu = new > > MenuItem.OnMenuItemClickListener() { > > public boolean onMenuItemClick(MenuItem item) { > > Toast.makeText(AlarmMenu.this, "custom menu", > > Toast.LENGTH_LONG).show(); > > return true; > > } > > }; > > I have not tried setOnMenuItemClickListener(). You might consider > switching to onContextItemSelected(), as shown here: > > http://github.com/commonsguy/cw-android/tree/master/Database/Constants/ > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

