File tree 1 file changed +5
-16
lines changed
app/src/main/java/io/github/xmu_android_basics/pm25
1 file changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -33,28 +33,17 @@ protected void onCreate(Bundle savedInstanceState) {
33
33
}
34
34
35
35
public void onButtonClick (View view ) {
36
- new Thread (new Runnable () {
37
- @ Override
38
- public void run () {
39
- citiesResponse = queryData (PM25_CITIES_REQUEST_URL );
40
-
41
- updateUi (citiesResponse );
42
- }
43
- }).start ();
36
+ citiesResponse = queryData (PM25_CITIES_REQUEST_URL );
37
+ updateUi (citiesResponse );
44
38
}
45
39
46
40
/**
47
41
* Update the screen to display information from the given response.
48
42
*/
49
- private void updateUi (final String response ) {
50
- final TextView responseTextView = (TextView ) findViewById (R .id .response );
43
+ private void updateUi (String response ) {
44
+ TextView responseTextView = (TextView ) findViewById (R .id .response );
51
45
52
- responseTextView .post (new Runnable () {
53
- @ Override
54
- public void run () {
55
- responseTextView .setText (response );
56
- }
57
- });
46
+ responseTextView .setText (response );
58
47
}
59
48
60
49
private String queryData (String queryString ) {
You can’t perform that action at this time.
0 commit comments