private void init() {
    mDbHelper = new DemoDBHelper(this);

    initData();

    mRecyclerView = (SupportRecyclerView) findViewById(R.id.demo_recyclerview);
    mRecyclerView.setEmptyView(findViewById(R.id.empty_view));
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new DemoRecyclerCursorAdapter(this, mDbHelper.queryAll());
    mAdapter.setOnItemClickListener(this);
    mAdapter.setOnItemLongClickListener(this);

    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setOnItemClickListener(this);
    mRecyclerView.setOnItemLongClickListener(this);
  }
 private void initData() {
   mDbHelper.insertUser(new User("user1", 20));
   mDbHelper.insertUser(new User("user2", 21));
   mDbHelper.insertUser(new User("user3", 22));
   mDbHelper.insertUser(new User("user4", 23));
   mDbHelper.insertUser(new User("user5", 24));
   mDbHelper.insertUser(new User("user6", 25));
   mDbHelper.insertUser(new User("user7", 26));
   mDbHelper.insertUser(new User("user8", 27));
   mDbHelper.insertUser(new User("user9", 28));
   mDbHelper.insertUser(new User("user10", 29));
   mDbHelper.insertUser(new User("user11", 30));
   mDbHelper.insertUser(new User("user12", 31));
   mDbHelper.insertUser(new User("user13", 32));
 }
 // delete all data
 public void delete(View view) {
   mDbHelper.deleteAll();
   mAdapter.getCursor().requery();
   Toast.makeText(this, "DELETE", Toast.LENGTH_SHORT).show();
   Log.e(TAG, "DELETE ALL");
 }