Bonjour,
J'ai un dialogue qui s'ouvre sans problème (button ajout) la 1ère fois et qui plante à la 2ème:
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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
                final View ajView = inflater.inflate(R.layout.new_part,
                null, false);//null,false
........
        final AlertDialog.Builder builder = new AlertDialog.Builder(vis_group.this)
 
                .setPositiveButton("Valid", new DialogInterface.OnClickListener() {
 
                    public void onClick(DialogInterface dialog, int id) {
...................
                        dialog.dismiss();
                    }
                })
                .setNegativeButton(Html.fromHtml("Cancel"), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
        builder.setView(null);
        builder.setView(ajView);
 
        builder.setTitle("Titre");
.......
           ajout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
 
                AlertDialog alertDialog =builder.create();
 
                alertDialog.show();
 
                Button pbutton=alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
                pbutton.setBackgroundColor(Color.rgb(241, 244, 197));
                pbutton.setTextColor(Color.rgb(9,73,24));
                pbutton.setTextSize(20);
                alertDialog.getWindow().setLayout(1500, 700); 
            }
        });
Donc sur le 2ème appel de ajout: sur alertDialog.show()
IllegalStateException:The specified child already has a parent.
You must call removeView on the child's parent first.

Que dois-je faire?
D'avance merci.