Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Double balance;
- public double getBalance(Address address){
- balance=0.0;
- String url = urlAPI+address.toString();
- RequestQueue reqQueue;
- reqQueue = Volley.newRequestQueue(this);
- JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET, url, null,
- new Response.Listener<JSONObject>() {
- @Override
- public void onResponse(JSONObject response) {
- try {
- if (response.get("data").toString() != "null") {
- balance = Double.parseDouble(response.get("data").toString()) / 100000000;
- } else {
- balance = 100.00000001;
- }
- ;
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- },
- new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- }
- }
- );
- reqQueue.add(jsonObjReq);
- return balance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement