Probleme d'affichage AlertDialog
Bonjour
Je veux aficher un AlertDialog sur un clic de menu
j'ai pas d'erreur mais pas d'affichage de l'AlertDialog
Mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| private void showDialog() {
final CharSequence[] Countries = { "India", "U.S.A", "U.K" };
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setIcon(R.drawable.icon);
alt_bld.setTitle("Select Country");
alt_bld.setSingleChoiceItems(Countries, 0,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getBaseContext(), Countries[item],
Toast.LENGTH_LONG).show();
alert.cancel();
}
});
alert = alt_bld.create();
alert.show();
} |
dans mon onOptionsItemSelected(MenuItem item)
Code:
1 2 3
| case VOIR_PAYS:
showDialog();
return true; |
Je n'arrive pas à voir où est l'erreur