-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainActivity.java
61 lines (45 loc) · 1.4 KB
/
MainActivity.java
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
package com.example.conect1;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import com.android.volley.Request.Method;
import com.android.volley.RequestQueue;
import com.android.volley.Response.Listener;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.JsonRequest;
import com.android.volley.toolbox.Volley;
public class MainActivity extends Activity {
RequestQueue queue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
queue = Volley.newRequestQueue(this);
final TextView textview1 = (TextView)findViewById(R.id.textview1);
Button button1 = (Button)findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自動生成されたメソッド・スタブ
Data1 r = new Data1(Method.GET, "http://ougou80.web.fc2.com/inside/proxy.txt", new Listener<String>() {
@Override
public void onResponse(String response) {
textview1.setText(response);
}
}, null);
queue.add(r);
}
});
}
protected void onStart(){
super.onStart();
queue.start();
}
protected void onStop(){
super.onStop();
queue.stop();
}
}