1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
public boolean onCreateOptionsMenu(android.view.Menu menu)
{
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
//R.menu.menu est l'id de notre menu
inflater.inflate(R.menu.menuoption,menu);
return true;
}
public boolean onOptionsItemSelected (MenuItem item)
{
switch(item.getItemId())
{
case R.id.item1:
CODE_DE_MON_ACTIVITE=3;
Intent intent3 = new Intent(AvionSolaire.this, NoticeUtilisateur.class);
//intent.putExtras(objetbunble);
startActivityForResult(intent3, CODE_DE_MON_ACTIVITE);
return true;
case R.id.item2:
CODE_DE_MON_ACTIVITE=2;
Intent intent2 = new Intent(AvionSolaire.this, TailleDonneesLegende.class);
//intent.putExtras(objetbunble);
startActivityForResult(intent2, CODE_DE_MON_ACTIVITE);
return true;
}
return super.onOptionsItemSelected(item);
}
/*
// méthodes qui géres tout les appuis sur les boutons de type (menu,retour,...) et qui affiche une informations,activité,.. en retour
public boolean onKeyDown(int keyCode, KeyEvent event)
{
//Log.i("A","choix pause ou destroy");
if (keyCode == KeyEvent.KEYCODE_BACK)
{
AlertDialog.Builder alertDialog = new AlertDialog.Builder(AvionSolaire.this);
// Setting Dialog Title
alertDialog.setTitle("Confirmation de votre Action");
// Setting Dialog Message
alertDialog.setMessage("Etes vous sur de vouloir quitter l'application?");
// Setting Icon to Dialog
alertDialog.setIcon(R.drawable.ic_launcher);
// Setting Positive "Yes" Button
alertDialog.setPositiveButton("OUI", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog,int which)
{
// Write your code here to invoke YES event
//Toast.makeText(getApplicationContext(), "Arret de l'application", Toast.LENGTH_SHORT).show();
finish();
};
});
// Setting Negative "NO" Button
alertDialog.setNegativeButton("NON", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
// Write your code here to invoke NO event
// Toast.makeText(getApplicationContext(), "Poursuite de l'application", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
});
// Showing Alert Message
alertDialog.show();
}
if(keyCode==KeyEvent.KEYCODE_MENU)
{
}
return true;
}
*/ |
Partager