title: How can I create List with dynamically number of items with Android Studio
body: <p>I created list using example: <a href="https://stackoverflow.com/questions/27661305/material-design-suggestions-for-lists-with-avatar-text-and-icon/27661786#27661786">Material design suggestions for lists with avatar, text and icon</a></p>
  <p>I want to have list with upcoming movies, so I need list with dynamically number of items. I dont understand and I dont know how I should do it.</p>
  <p>There is my code for one item list:</p>
  <pre><code>public class FragmentOne extends Fragment {
  
      TextView textView;
      TextView textView2;
      ImageView imageView;
  
      public static FragmentOne newInstance() {
          FragmentOne fragment = new FragmentOne();
          return fragment;
      }
  
      public class MovieTask extends AsyncTask&lt;Void, Void, MovieDb&gt;{
          @Override
          protected MovieDb doInBackground(Void... voids) {
              TmdbMovies movies = new TmdbApi(&quot;my_api_key&quot;).getMovies();
              MovieDb movie = movies.getMovie(5335, &quot;en&quot;);
  
              return movie;
          }
  
          @Override
          protected void onPostExecute(MovieDb movieDb) {
              textView.setText(movieDb.getOriginalTitle());
              textView2.setText(movieDb.getReleaseDate());
              Glide.with(imageView).load(&quot;https://image.tmdb.org/t/p/w500&quot; + movieDb.getPosterPath()).into(imageView);
          }
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          MovieTask mt = new MovieTask();
          mt.execute();
          super.onCreate(savedInstanceState);
      }
      
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View returnView = inflater.inflate(R.layout.fragment_one, container, false);
          textView = (TextView) returnView.findViewById(R.id.text);
          textView2 = (TextView) returnView.findViewById(R.id.text2);
          imageView = (ImageView) returnView.findViewById(R.id.list_icon);
  
  
          return returnView;
      }
  }
  </code></pre>
  <p>and xml for that class</p>
  <pre><code>&lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;72dp&quot;
      tools:context=&quot;.FragmentOne&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/list_icon&quot;
          android:layout_width=&quot;40dp&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_margin=&quot;16dp&quot; /&gt;
  
      &lt;LinearLayout
          android:orientation=&quot;vertical&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:gravity=&quot;center_vertical&quot;
          android:layout_toRightOf=&quot;@+id/list_icon&quot;
          android:layout_alignParentRight=&quot;true&quot;
          android:layout_alignParentEnd=&quot;true&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:layout_alignParentBottom=&quot;true&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/text&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:paddingRight=&quot;16dp&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/text2&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:paddingRight=&quot;16dp&quot; /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>