Bonjour
Sur mon actvity :
j'ai quatre imageButton
Code : Sélectionner tout - Visualiser dans une fenêtre à part public class lyfiche extends Activity implements android.view.View.OnClickListener{
Je récuprère le clic comme suit
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 ((ImageButton)this.findViewById(R.id.btntel)).setOnClickListener(this); ((ImageButton)this.findViewById(R.id.btnmail)).setOnClickListener(this); ((ImageButton)this.findViewById(R.id.btncontact)).setOnClickListener(this); ((ImageButton)this.findViewById(R.id.btnfavori)).setOnClickListener(this);
Quand je clic la boite de dialogue ne s'affiche pas
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
17
18
19
20
21 public void onClick(View v) { switch(v.getId()){ case R.id.btncontact: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Ajouter à mes contacts ?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // MyActivity.this.finish(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); case R.id.btnfavori: ..............................
Merci pour la solution
Partager