-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroidCodeWebService.txt
More file actions
23 lines (20 loc) · 1.22 KB
/
androidCodeWebService.txt
File metadata and controls
23 lines (20 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
private final String uRL = "http://192.168.0.102:8080/IamatRest/set/book";
final TextView tx = (TextView) findViewById(R.id.textView);
//tx.setText("I am done");
final RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
StringRequest stringRequest = new StringRequest(Request.Method.GET, uRL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
tx.setText(response);
requestQueue.stop();
}
}, new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError volleyError){
tx.setText("Something went wrong...");
volleyError.printStackTrace();
requestQueue.stop();
}
});
requestQueue.add(stringRequest);