Bonjour à tous,

j'ai un boutton dans un fragment, lors du click sur celui-ci je n'ai aucune réaction. C'est la première foi que j'ai un problème de ce genre... Je ne comprend vraiment pas d'où peut venir mon problème

Ma classe Java

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
public class MyFragmentC extends Fragment{
 
 
	Button envoyer;
 
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
		getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
		View myFragmentView = inflater.inflate(R.layout.fragment_c, container, false);
		getActivity().setContentView(R.layout.fragment_c);
 
		getActivity().setProgressBarIndeterminateVisibility(false);
 
		envoyer = (Button) getActivity().findViewById(R.id.envoyer);
 
 
		reactions();
 
		return myFragmentView;
 
	}
 
 
 
	public void reactions(){
 
		envoyer = (Button)getActivity().findViewById(R.id.envoyer);
 
		envoyer.setOnClickListener(new View.OnClickListener(){
		    @Override
		    public void onClick(View view) {
 
 
		    	new AlertDialog.Builder(getActivity()).setTitle("Ca marche").show(); 
		    	Log.d("Etape 1","ok");
 
 
		    }
 
 
		});
 
 
	}
}



Mon fichier xml (Le bouton "envoyer" est tout en bas)

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
<?xml version="1.0" encoding="utf-8"?>
 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" 
    android:background="@color/background">
 
 
    <!-- Correspondra au fragment Contact -->
 
 
 
	<TableLayout android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:stretchColumns="2">
 
 
 
		<TextView android:text="@string/vide"/>
 
 
 
 
        <TableRow>
 
            <TextView android:text="@string/vide"/>
 
        </TableRow>
 
 
 
 
        <TableRow>
 
 
            <!-- L'objet de l'avois du message -->
 
            <EditText
                android:id="@+id/objet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ems="10"
                android:hint="@string/textContact1"
                android:textColor="@color/colorEditText" />
 
 
        	<TextView android:text="@string/vide"/>
 
 
        </TableRow>
 
 
 
 
        <TableRow>
 
 
            <!-- Adresse personnel pour que l'on puisse nous répondre -->
            <EditText
                android:id="@+id/email"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ems="10"
                android:inputType="textEmailAddress"
                android:hint="@string/textContact2" 
                android:textColor="@color/colorEditText" >
 
                <requestFocus />
            </EditText>
 
        </TableRow>
 
 
 
        <TableRow>
 
            <TextView android:text="@string/vide"/>
 
        </TableRow>
 
 
 
 
        <TableRow>
 
            <TextView android:text="@string/vide"/>
 
        </TableRow>
 
 
 
 
        <TableRow>
 
 
            <!-- Le message à envoyer -->
 
            <EditText
                android:id="@+id/message"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ems="10"
                android:hint="@string/textContact3"
                android:inputType="textMultiLine"
                android:gravity="top|left"
                android:windowSoftInputMode="adjustPan" 
                android:textColor="@color/colorEditText" />
 
        	<TextView android:text="@string/vide"/>
 
        </TableRow>
 
 
 
	<LinearLayout 
		android:orientation="vertical" 
		android:layout_width="fill_parent"
		android:layout_height="fill_parent" 
		android:gravity="bottom|right"
		android:layout_marginRight="50dp"
		android:layout_marginBottom="70dp">
 
 
	    <!-- Bouton envoyer, pour envoyer le message -->
 
				<Button
					android:id="@+id/envoyer"
					android:layout_width="wrap_content"
					android:layout_height="wrap_content"
					android:text="@string/btnContact"
					android:background="#93DCFE"
					android:textColor="#ffffff"/>
 
 
	</LinearLayout>
 
	</TableLayout>
 
</ScrollView>

Pourquoi ne mon bouton ne réagi pas? est-ce parce que je suis dans un Fragment?

Je vous remercie d'avance si vous avez des éléments de réponse!

Bien cordialement.