Sunday, May 13, 2012

Re: [android-developers] Menu : Handling click events : DialogBox

在 2012-5-12 下午6:23,"huberte" <svend.walter@gmail.com>写道:

Hi, 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.

thks


--
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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate