title: Display Int ArrayList in RecyclerView (Android Studio)
body: <p>I'm trying to display an ArrayList of Integers inside of a RecyclerView, the Integer values in the ArrayList are downloaded from JSON, all that is done, the thing I need help with is to display them in a RecyclerView.</p>
  
  <p>Here's part of the MainActivity:</p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity {
  
  private ActivityMainViewModel viewmodel;
  RecyclerView recyclerView;
  RecyclerView.Adapter mAdapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //setContentView(R.layout.activity_main);
  
      recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
      recyclerView.setLayoutManager(new LinearLayoutManager(this));
      mAdapter = new MainAdapter(JsonData.rideList);
      recyclerView.setAdapter(mAdapter);
  
      ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
  
      viewmodel = new ActivityMainViewModel();
      binding.setViewmodel(viewmodel);
  }
  </code></pre>
  
  <p>Here's the MainAdapter class:</p>
  
  <pre><code>    class MainAdapter extends android.support.v7.widget.RecyclerView.Adapter&lt;MainAdapter.ViewHolder&gt; {
  
  int ride;
  private ArrayList&lt;Integer&gt; rideList;
  
  public MainAdapter(ArrayList&lt;Integer&gt; rideList)
  {
      this.rideList = rideList;
  }
  
  @Override
  public MainAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
  {
      View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_main, null);
      ViewHolder viewHolder = new ViewHolder(view);
      return viewHolder;
  }
  
  @Override
  public void onBindViewHolder(MainAdapter.ViewHolder holder, int position)
  {
      holder.rideHeight.setText(ride);
  }
  
  @Override
  public int getItemCount()
  {
      return (null != rideList ? rideList.size() : 0);
  }
  
  public class ViewHolder extends RecyclerView.ViewHolder {
  
      public TextView rideHeight;
      public ViewHolder(View itemView) {
          super(itemView);
  
          rideHeight = (TextView) itemView.findViewById(R.id.rideHeight_textView);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Btw the rideHeight_textView is a TextView inside of the RecyclerView, dont know if that's the proper way to do it but that's what everyone else seems to be doing.</p>
  
  <p>I know that it probably looks a mess but that's because I have been searching both on google and youtube on how to use RecyclerView so I might have mixed from different tutorials and tried somethings myself. All the tutorials I read or watched were using an ArrayList of objects while I'm using Int's.</p>
  
  <p>Thanks!</p>
  
  <p>Edit: Apparently I'm getting this fatal exception:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.remi.uppgift/com.example.remi.uppgift.MainActivity}: android.view.InflateException: Binary XML file line #91: RecyclerView has no LayoutManager
  </code></pre>