Je me suis inspiré du lien http://developer.android.com/guide/t...ShowingADialog
et j'ai modifié mon code comme ceci
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public void FicheDialog(String nom){
AlertDialog.Builder builder;
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle(nom);
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,
(ViewGroup) findViewById(R.id.layout_root));
TextView text = (TextView) layout.findViewById(R.id.mydescro);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) layout.findViewById(R.id.mylogo);
image.setImageResource(R.drawable.van_2);
builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
alertDialog = builder.create();
ad.show();
} |
J'ai déclaré ma variable
private AlertDialog alertDialog;
Mais cela m'affiche une boite vide (juste le titre affiché)
Pouvez-vous m'indiquer l'erreur
Merci
Partager