@@ -38,6 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {
38
38
initData ();
39
39
40
40
initView ();
41
+ initData ();
41
42
}
42
43
43
44
/**
@@ -75,6 +76,21 @@ private void initView() {
75
76
spinner .setAdapter (spinnerAdapter );
76
77
spinner .setSelected (true );
77
78
79
+
80
+ editText = (EditText ) findViewById (R .id .edittext );
81
+ button1 = (Button ) findViewById (R .id .button1 );
82
+ button2 = (Button ) findViewById (R .id .button2 );
83
+ button3 = (Button ) findViewById (R .id .button3 );
84
+ button4 = (Button ) findViewById (R .id .button4 );
85
+ button5 = (Button ) findViewById (R .id .button5 );
86
+
87
+ }
88
+
89
+ /**
90
+ * 初始化事件监听
91
+ */
92
+ private void initListener () {
93
+
78
94
spinner .setOnItemSelectedListener (new AdapterView .OnItemSelectedListener () {
79
95
@ Override
80
96
public void onItemSelected (AdapterView <?> parent , View view , int position , long id ) {
@@ -140,8 +156,6 @@ public void onNothingSelected(AdapterView<?> parent) {
140
156
}
141
157
});
142
158
143
- editText = (EditText ) findViewById (R .id .edittext );
144
- button1 = (Button ) findViewById (R .id .button1 );
145
159
button1 .setOnClickListener (new View .OnClickListener () {
146
160
@ Override
147
161
public void onClick (View v ) {
@@ -162,7 +176,6 @@ public void onImageClick(View view, AdInfo advInfo) {
162
176
}
163
177
});
164
178
165
- button2 = (Button ) findViewById (R .id .button2 );
166
179
button2 .setOnClickListener (new View .OnClickListener () {
167
180
@ Override
168
181
public void onClick (View v ) {
@@ -180,7 +193,6 @@ public void onImageClick(View view, AdInfo advInfo) {
180
193
}
181
194
});
182
195
183
- button3 = (Button ) findViewById (R .id .button3 );
184
196
button3 .setOnClickListener (new View .OnClickListener () {
185
197
@ Override
186
198
public void onClick (View v ) {
@@ -198,7 +210,6 @@ public void onImageClick(View view, AdInfo advInfo) {
198
210
}
199
211
});
200
212
201
- button4 = (Button ) findViewById (R .id .button4 );
202
213
button4 .setOnClickListener (new View .OnClickListener () {
203
214
@ Override
204
215
public void onClick (View v ) {
@@ -216,7 +227,6 @@ public void onImageClick(View view, AdInfo advInfo) {
216
227
}
217
228
});
218
229
219
- button5 = (Button ) findViewById (R .id .button5 );
220
230
button5 .setOnClickListener (new View .OnClickListener () {
221
231
@ Override
222
232
public void onClick (View v ) {
0 commit comments