Bonjour
J'ai créé un CustomDialog avec un TextView, un EditView et 2 boutons
L'ouverture de la CustomDialog fonctionne sans problème. Je peux même changer dynamiquement le titre de la CustomDialog. Le problème se pose quand je veux changer dynamiquement le texte de la TextView.
Il y a plantage au niveau du setText.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Dialog dialog; Context mContext = getApplicationContext(); dialog = new Dialog(this); dialog.setContentView(R.layout.dialog); String strText = ""; String strTitre = ""; switch(id) { case dlg_1: TextView dtgTextView= (TextView) findViewById(R.id.TextView01); dtgTextView.setText("Nouveau Test"); strTitre = getString(R.string.app_name); dialog.setTitle(strTitre); break;
J'ai fait l'essai dans une appli simple (sans DialogBox), la méthode setText fonctionne correctement.
Une idée ?
Partager