title: Why does the app displays nothing even though i have no running error?
body: <p>I am trying to do a weather App and after I get the data and I try to display it, I also try to see it in Log because it displays nothing, but here it also shows nothing. I also have no errors in running.
  This is the code: </p>
  
  <pre><code>package com.example.weatherapp;
  
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  import org.json.JSONArray;
  import org.json.JSONObject;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.MalformedURLException;
  import java.net.URL;
  
  public class MainActivity extends AppCompatActivity {
  
      TextView cityName;
      Button searchButton;
      TextView result;
  
      class Weather extends AsyncTask&lt;String, Void, String&gt;{
  
  
          @Override
          protected String doInBackground(String... adress) {
  
              try {
                  URL url = new URL(adress[0]);
                  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  
                  connection.connect();
  
                  InputStream is = connection.getInputStream();
                  InputStreamReader isr = new InputStreamReader(is);
  
                  int data = isr.read();
                  String content = "";
                  char ch;
                  while (data != -1){
                      ch = (char) data;
                      content = content + ch;
                      data = isr.read();
                  }
  
                  return content;
  
  
              } catch (MalformedURLException e) {
                  e.printStackTrace();
              } catch (IOException e) {
                  e.printStackTrace();
              }
  
              return null;
          }
      }
  
  
      public void search (View view){
          cityName = findViewById(R.id.cityName);
          searchButton = findViewById(R.id.searchButton);
          result = findViewById(R.id.result);
  
  
          String cName = cityName.getText().toString();
  
          String content;
          Weather weather = new Weather();
          try {
              content = weather.execute("https://openweathermap.org/data/2.5/weather?q=" + cName + "&amp;appid=439d4b804bc8187953eb36d2a8c26a02").get();
  
              JSONObject jsonObject = new JSONObject(content);
              String weatherData = jsonObject.getString("weather");
  
              JSONArray array = new JSONArray(weatherData);
  
              String main ="";
              String description ="";
  
              for (int i = 0; i&lt;=array.length(); i++){
                  JSONObject weatherPart = array.getJSONObject(i);
                  main = weatherPart.getString("main");
                  description = weatherPart.getString("description");
              }
  
              Log.w("main", main);
              Log.w("description", description);
  
              result.setText("Main : "+ main + "\nDescription : "+ description);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
      }
  }
  </code></pre>
  
  <p>The searchButton onClickListener is implemented in XML, so it works, and here is what the log displays when I run the app:</p>
  
  <pre><code>2020-04-20 21:46:22.482 12518-12611/com.example.weatherapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err: org.json.JSONException: Index 1 out of range [0..1)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at org.json.JSONArray.get(JSONArray.java:293)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at org.json.JSONArray.getJSONObject(JSONArray.java:521)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at com.example.weatherapp.MainActivity.search(MainActivity.java:88)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at android.view.View.performClick(View.java:5610)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at android.view.View$PerformClick.run(View.java:22265)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at android.os.Looper.loop(Looper.java:154)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6077)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
  2020-04-20 21:46:22.896 12518-12518/com.example.weatherapp W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
  </code></pre>
  
  <p>I can't find any clue why this doesn't work. Can you help me?</p>