title: how to url calling return from list function with retrofit
body: <p>i tried to return list from the url that i get with retrofit. it works and i get the data but it wont return.</p>
  
  <p>this is my code </p>
  
  <pre><code>public List&lt;MovieResponse&gt; loadCourses() {
      ArrayList&lt;MovieResponse&gt; list = new ArrayList&lt;&gt;();
  
      ApiServices apiService =
              NetworkClient.getRetrofitClient().create(ApiServices.class);
  
      Call&lt;MovieResult&gt; call = apiService.getMovies();
      call.enqueue(new Callback&lt;MovieResult&gt;() {
          @Override
          public void onResponse(Call&lt;MovieResult&gt; call, Response&lt;MovieResult&gt; response) {
              if (response.body() != null) {
                  ArrayList&lt;MovieResponse&gt; movies = new ArrayList&lt;&gt;();
                  movies = response.body().getResults();
                  Log.d("",""+movies);
                  list.addAll(movies);
                  Log.d("",""+list);
              }
          }
  
          @Override
          public void onFailure(Call&lt;MovieResult&gt; call, Throwable t) {
              // Log error here since request failed
              Log.e("error", t.toString());
          }
      });
       return list;
  }
  </code></pre>
  
  <p>when i print list inside <code>onResponse</code> it works and there are the data. but when i return it or trying to print list outside <code>onResponse</code> for example below <code>ArrayList&lt;MovieResponse&gt; list = new ArrayList&lt;&gt;();</code> it not show the data.</p>
  
  <p>please help what is actually wrong with it. i really appreciate it.</p>