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