title: Display ArrayList from SQLite DB Android in recyclerView
body: <p>When i try to display <code>ArrayList</code> in <code>recyclerview</code> I have <code>NullPointerExeption</code>, I checked to display <code>Arraylist</code> in Logs and it work well, i think  my mistake is in <code>RecyclerViewAdapter</code>. So please help me find my mistake and explain</p>
  
  <p>My method in DB to create <code>Arraylist</code>:</p>
  
  <pre><code>public List&lt;Cards&gt; getData(){
  
      List&lt;Cards&gt; list = new ArrayList&lt;&gt;();
      SQLiteDatabase sqLiteDatabase= helper.getWritableDatabase();
      Cursor cursor= sqLiteDatabase.rawQuery(helper.QUERY,null);
      while (cursor.moveToNext()){
  
          int index0=cursor.getColumnIndex(helper.UID);
  
          int index1=cursor.getColumnIndex(helper.KEY_NAME);
          int index2=cursor.getColumnIndex(helper.KEY_VALUE);
          int index3=cursor.getColumnIndex(helper.KEY_FORMAT);
          int index4=cursor.getColumnIndex(helper.KEY_COUNTRY);
  
          int cid = cursor.getInt(index0);
          String name = cursor.getString(index1);
          String value = cursor.getString(index2);
          String format = cursor.getString(index3);
          String country = cursor.getString(index4);
          Cards cards = new Cards(cid,name,value,format,country);
  
          list.add(cards);
  
      }
  
      return list;
  
  }
  </code></pre>
  
  <p>Cards is my getter &amp; setter class,</p>
  
  <p>RecyclerViewAdapter:</p>
  
  <pre><code>public class RecycleViewAdapter extends RecyclerView.Adapter&lt;RecycleViewAdapter.MyViewHolder&gt; {
  private static final String TAG = "recyclerViewAdapter";
  
  
  private List&lt;Cards&gt; items;
  private int itemLayout;
  
  public RecycleViewAdapter(List&lt;Cards&gt; items, int itemLayout) {
  
      this.items = items;
      this.itemLayout= itemLayout;
  }
  
  @Override
  public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
     View view=LayoutInflater.from(parent.getContext()).inflate(itemLayout,parent,false);
      return new MyViewHolder(view);
  }
  
  @Override
  public void onBindViewHolder(MyViewHolder holder, int position) {
  
  
      Cards item=items.get(position);
      holder.title.setText(item.getName());
  
  }
  
  @Override
  public int getItemCount() {
  
      return items.size();
  }
  public static class  MyViewHolder extends RecyclerView.ViewHolder{
  
      TextView title;
      public MyViewHolder(View itemView) {
  
          super(itemView);
  
          title= (TextView) itemView.findViewById(R.id.listText);
      }
  }
  
  
  
  
  `MyCardsFragment` , where i have `recyclerView`:
  
      public class MyCardsFragment extends Fragment {
      public DataBaseAdapter data;
      private static final String TAG = "MyApp";
  
      private RecyclerView recyclerView;
      DataBaseAdapter dataBaseHelper;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.fragment_my_cards, container, false);
  
  
          recyclerView = (RecyclerView) view.findViewById(R.id.recycleView);
  
          recyclerView.setHasFixedSize(true);
  
          recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  
          recyclerView.setItemAnimator(new DefaultItemAnimator());
  
          recyclerView.setAdapter(new RecycleViewAdapter(dataBaseHelper.getData(),R.layout.custom_row));
          return view;
  
      }
  }
  </code></pre>
  
  <p><code>NullPointerExeption</code> is on </p>
  
  <p><code>recyclerView.setAdapter(newrecycleViewAdapter(dataBaseHelper.getData(),R.layout.custom_row))</code>;</p>