Bonjour,
j'effectue actuellement une application android qui me permet de tracer des lignes que je concidere comme des murs. Lorsque je clique sur une ligne j'ai une barre de menu qui apparait avec un bouton parametre. Une fois que je clique sur ce bouton une pop up apparait avec differentes proprietes de mon murs. Parmi celle ci j'aimerai utiliser un RadioGroup avec deux boutons pour choisir si mon mur est exterieur ou interieur pour cela j'ai ecrit dans mon fichier xml :

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
 
 
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
 
        <RadioGroup
            android:id="@+id/radioWall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
 
            <RadioButton
                android:id="@+id/radioInteralWall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="130dp"
                android:layout_marginTop="8dp"
                android:text="@string/modeInternalWall" />
 
            <RadioButton
                android:id="@+id/radioExternalWall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="50dp"
                android:layout_marginTop="8dp"
                android:checked="true"
                android:text="@string/modeExternalWall" />
        </RadioGroup>
    </LinearLayout>
et sinon dans mon code principal :

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
 
 
protected void onPrepareDialog(int id, Dialog dialog) {
 
		/** Initialisation des pop-up de modification **/
		final AlertDialog alertDialog = (AlertDialog) dialog;
		final Wall selectedWall = plan.getSelectedWall();
 
		switch (id) {
 
		/**
                 * Cas d'un Mur
                 */
		case DIALOG_EDIT_WALL:
 
 
			final EditText wall_name = (EditText) alertDialog
					.findViewById(R.id.edit_wallName);
 
			/**
                         * RadioGroup Mur Interieur/Exterieur
                         */
			final RadioGroup radioModeWall = (RadioGroup) findViewById(R.id.radioWall);
 
			/**
                         * Nom du Mur
                         */
			wall_name.setText(selectedWall.getName_Elt());
			wall_name.setVisibility(RelativeLayout.VISIBLE);
 
			Button validbutton = (Button) alertDialog
					.findViewById(R.id.valide_wall);
			Button cancelbutton = (Button) alertDialog
					.findViewById(R.id.cancel_wall);
 
			/**
                         * Gestion du bouton de Validation
                         */
			validbutton.setOnClickListener(new OnClickListener() {
 
				@SuppressWarnings("static-access")
				public void onClick(View v) {
					if (!plan
							.getCurrentFloor()
							.getPlanBatiment()
							.containsWallWithName(
									wall_name.getText().toString(),
									selectedWall)) {
 
 
						radioModeWall.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
 
							@Override
							public void onCheckedChanged(RadioGroup group, int checkedId) {
								RadioButton rb = (RadioButton) group.findViewById(checkedId);
								if(null!=rb && checkedId >-1){
									Toast.makeText(getApplicationContext(), rb.getText(), Toast.LENGTH_SHORT).show();
								}
 
							}
						});
 
						selectedWall
								.setName_Elt(wall_name.getText().toString());
 
 
						/**
                                                 * Verification si le nom du Mur n'est pas null
                                                 */
						if (wall_name.getText().toString().equals("")) {
							LayoutInflater inflater = getLayoutInflater();
 
							View layout = inflater
									.inflate(
											R.layout.custom_toast,
											(ViewGroup) findViewById(R.id.custom_toast_layout_id));
 
							/** Image **/
							ImageView image = (ImageView) layout
									.findViewById(R.id.image);
							image.setImageResource(R.drawable.warning);
 
							/** Message **/
							TextView text = (TextView) layout
									.findViewById(R.id.text);
							text.setText(" Champ Name null ");
							text.setBackgroundColor(Color.WHITE);
 
							/** Toast **/
							Toast toast = new Toast(appContext);
							toast.setDuration(Toast.LENGTH_SHORT);
							toast.setGravity(Gravity.CENTER_VERTICAL, 380, -255);
							toast.setView(layout);
							toast.show();
 
							wall_name.requestFocus();
							return;
						}
 
					} else {
 
						LayoutInflater inflater = getLayoutInflater();
 
						View layout = inflater
								.inflate(
										R.layout.custom_toast,
										(ViewGroup) findViewById(R.id.custom_toast_layout_id));
 
						/** Image **/
						ImageView image = (ImageView) layout
								.findViewById(R.id.image);
						image.setImageResource(R.drawable.warning);
 
						/** Message **/
						TextView text = (TextView) layout
								.findViewById(R.id.text);
						text.setText(" Demande Impossible !!! \n "
								+ " Un Mur porte deja ce nom ");
						text.setBackgroundColor(Color.WHITE);
 
						/** Toast **/
						Toast toast = new Toast(appContext);
						toast.setDuration(Toast.LENGTH_LONG);
						toast.setView(layout);
						toast.show();
 
					}
					selectedWall.setSelected(false);
					plan.setSelectedWall(null);
					plan.getSelectionElementListener().setWallSelected(null);
					changeToMenu(MENU_EDITION);
					alertDialog.dismiss();
				}
			});
 
			/**
                         * Gestion du bouton Annuler
                         */
			cancelbutton.setOnClickListener(new OnClickListener() {
 
				public void onClick(View v) {
					selectedWall.setSelected(false);
					plan.setSelectedWall(null);
					plan.getSelectionElementListener().setWallSelected(null);
					changeToMenu(MENU_EDITION);
					alertDialog.dismiss();
				}
			});
			break;

j'ai essayé cela on me donne une erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
E/AndroidRuntime(8642): FATAL EXCEPTION: main
E/AndroidRuntime(8642): java.lang.NullPointerException
Donc si quelqu'un a une idée, merci