Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
- String url="http://www.ip-api.com/json";
- // Request a string response from the provided URL.
- StringRequest stringRequest1 = new StringRequest(Request.Method.GET, url,
- new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- JSON json = fromStringToJSON(response);
- if (json.obj != null) {
- JSONObject jsonObject = (JSONObject) json.obj;
- try {
- Log.d("timezone", jsonObject.getString("timezone"));
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement