title: android get two jsonArray and inflate them
body: <p>I have two json array (cast,crew) and I am using this code to inflate first one to my HorizontalScrollView.</p>
  
  <pre><code>    JSONArray casts = castImageResponse.getJSONArray("cast");
  
  String image = null;
  String name = null;
  
  if (casts.length() &gt; 0) {
  
      for (int i = 0; i &lt;= casts.length(); i++) {
  
          JSONObject cast = casts.getJSONObject(i);
          image = cast.getString("profile_path");
          name = cast.getString("name");
          View view = mInflater.inflate(R.layout.index_actors_gallery,mGallery, false);
          ImageView img = view.findViewById(R.id.id_index_actors_image);
          Picasso.get().load("https://image.tmdb.org/t/p/h632"+image).into(img);
          TextView txt = view.findViewById(R.id.id_index_actors_name);
          txt.setText(name);
          mGallery.addView(view);
  
  
      }
  
  }
  </code></pre>
  
  <p>When I am using this code for the second one, it's not working and only the first one works.
  I think I need the second method start "only" after the first one finish.
  How do I execute second one only after first one finish?</p>