From cc03f564c09710ffe96bf5e43b9164d2be2a5d24 Mon Sep 17 00:00:00 2001 From: shivamPatwal <70857952+shivamPatwal@users.noreply.github.com> Date: Sun, 27 Jun 2021 11:30:48 +0530 Subject: [PATCH] Update MainActivity.java --- .../example/weatherpractice/MainActivity.java | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/Weatherpractice/app/src/main/java/com/example/weatherpractice/MainActivity.java b/Weatherpractice/app/src/main/java/com/example/weatherpractice/MainActivity.java index 0d71304..4c7c52d 100644 --- a/Weatherpractice/app/src/main/java/com/example/weatherpractice/MainActivity.java +++ b/Weatherpractice/app/src/main/java/com/example/weatherpractice/MainActivity.java @@ -51,58 +51,56 @@ public void find (View view) //onclick public void onResponse(JSONObject response) { try { // Log.i("response", response.getString("weather")); - JSONArray arr = new JSONArray(response.getString("weather")); - for(int i=0;i() { - @Override - public void onResponse(JSONArray response) { + JsonObjectRequest jsonObjectRequest1 = new JsonObjectRequest(Request.Method.GET, + "https://api.openweathermap.org/data/2.5/weather?q=london&appid=4a91b112d83a2c5fdb11d3347cd4dd9f", null, new Response.Listener() { + public void onResponse(JSONObject response) { try { - JSONArray arr = new JSONArray(response.getString(Integer.parseInt("main"))); - for(int i=0;i