You can put it in both it's the same.

You just forgot to show the created dialog :)

Dialog dialog = new AlertDialog.Builder(this).setTitle("About").setMessage("el 
viva Android  !").create();
dialog.show();




Le samedi 12 mai 2012 12:10:20 UTC+2, huberte a écrit :
>
> I did red
>
> http://developer.android.com/guide/topics/ui/menus.html
>
> http://developer.android.com/guide/topics/resources/menu-resource.html
>
> I wrote this in main activity
>
> @Override   
> public boolean onCreateOptionsMenu(Menu menu) {
>     MenuInflater inflater = getMenuInflater();
>     inflater.inflate(R.menu.mainmenu, menu);
>     return true;
> }
> @Override
> public boolean onOptionsItemSelected(MenuItem item) {
>     // Handle item selection
>     switch (item.getItemId()) {
>         case R.id.infos:
>             infos();
>             return true;
>         case R.id.waring:
>             waring();
>             return true;
>         case R.id.credits:
>             credits();
>             return true;
>         case R.id.about:
>             about();
>             return true;
>         default:
>             return super.onOptionsItemSelected(item);
>     }
> }
> private void about() {
> //      // TODO Auto-generated method stub
> //      // custom dialog
>
> }
>
> Where shoudd I put my alertbox (is this correct for a simple text box with 
> no button ?) :
>
> new AlertDialog.Builder(this).setTitle("About").setMessage("el viva Android  
> !").create();
>
> in private void about(), which never works
>
> or directly in case R.id.about: about();
>
> Quit lost here.
>
>
>

-- 
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

Reply via email to