-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.java
More file actions
36 lines (28 loc) · 1.07 KB
/
Example.java
File metadata and controls
36 lines (28 loc) · 1.07 KB
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
public class Example extends AppCompatActivity {
.....
private void callApi() {
NetRequestManager.OnResponse onResponse = new NetRequestManager.OnResponse() {
@Override
public void onSuccess(String response) {
ArrayList<Category> data = new Gson().fromJson(response, new TypeToken<List<Category>>() {}.getType());
adapter.setData(data);
}
@Override
public void onError(VolleyError error) {
int statusCode = error.networkResponse.statusCode;
String body = new String(error.networkResponse.data,"UTF-8");
.....
finish();
}
};
HashMap<String, String> params = new HashMap<>();
params.put("token", FirePreference.getToken(this));
new NetRequestManager.Builder()
.setEndPoint(NetRequestManager.HOST + "/category")
.setHeader(params)
.setOnResponse(onResponse)
.build()
.get();
}
.....
}