title: android list the data from database using recyclerview
body: <p>I want display the data's from android database. Here i am using recycler view. The reference code is <a href="http://www.androidhive.info/2016/01/android-working-with-recycler-view/" rel="nofollow noreferrer">http://www.androidhive.info/2016/01/android-working-with-recycler-view/</a> . My code shown below.</p>
  
  <pre><code>SpeedDialViewActivity.java
  
  public class SpeedDialViewActivity extends AppCompatActivity {
  private List&lt;Bean&gt; beanList = new ArrayList&lt;&gt;();
  private RecyclerView recyclerView;
  private ViewAdapter mAdapter;
  Context context;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_speed_dial_view);
      recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
      mAdapter = new ViewAdapter(beanList);
      RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
      recyclerView.setLayoutManager(mLayoutManager);
      recyclerView.setItemAnimator(new DefaultItemAnimator());
      recyclerView.setAdapter(mAdapter);
      prepareData();
  }
  
  private void prepareData() {
      DatabaseHandler handler = new DatabaseHandler(getApplicationContext());
      Log.d("Reading: ", "Reading all contacts..");
      List&lt;Bean&gt; beanList = handler.getAllContacts();
      Bean bean;
     for (Bean cn : beanList) {
          String log = "Id: " + cn.getId() + " ,Name: " + cn.getName() + " ,Phone: " + cn.getNumber();
          // Writing Contacts to log
          Log.d("Name: ", log);
         /* bean = new Bean(cn.getName(), cn.getNumber(), cn.getSpeeddial());
          beanList.add(bean);
          }*/
  
  
  
  
     /* Bean bean = new Bean("Mad Max: Fury Road", "Action &amp; Adventure", "2015");
      beanList.add(bean);
  
      bean = new Bean("Inside Out", "Animation, Kids &amp; Family", "2015");
      beanList.add(bean);
      bean = new Bean("Inside Out", "Animation, Kids &amp; Family", "2015");
      beanList.add(bean);
      bean = new Bean("Inside Out", "Animation, Kids &amp; Family", "2015");
      beanList.add(bean);*/
  }
  }
  </code></pre>
  
  <p>In the prepareData() method i can print answer in log. But i cannot display in my activity. Please help me.</p>