title: change data in recyclerview
body: <p>Seems like I still can't get hold of how notifydatasetchanged works. I tried to update a variable in adapter, but couldn't do it successfully. I tried like below, also tried to define separate class Nav Drawer items, but just couldn't do anything.</p>
  
  <p>Basically, the count should be updated time to time, so I just need to update that in NavDrawer. Definitely I have some misunderstanding how notifydatasetchanged works.</p>
  
  <p><strong>I am pretty much sure I did some thing similar to METHOD 2 using ListView in past. Only difference was, I used an ArrayList in that case, but here I am directly storing arrays inside NavDrawerList and pass that to adapter.</strong></p>
  
  <p><strong>Method 1</strong></p>
  
  <pre><code>public class ActivityMain extends AppCompatActivity{
  
      private String[] navMenuTitles;
      public int count;
  
      RecyclerView mRecyclerView;
      RecyclerView.Adapter mAdapter;
      RecyclerView.LayoutManager mLayoutManager;
      DrawerLayout mDrawerLayout;
      ActionBarDrawerToggle mDrawerToggle;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
          count = 20;
  
          mRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView);
          mRecyclerView.setHasFixedSize(true);
          mAdapter = new NavDrawerAdapter(navMenuTitles, count);
          mRecyclerView.setAdapter(mAdapter);
          mLayoutManager = new LinearLayoutManager(this);
          mRecyclerView.setLayoutManager(mLayoutManager);
          mDrawerLayout = (DrawerLayout) findViewById(R.id.DrawerLayout);
  
          mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.openDrawer, R.string.closeDrawer);
          mDrawerLayout.setDrawerListener(mDrawerToggle);
      }
  
      public void updateCount(){
          count = 10;
          mAdapter.notifyDataSetChanged(); // DRAWER STILL SHOWS 20 EVEN IF I CALL THIS FUNCTION
      }
  }
  
  
  
  
  
  public class NavDrawerAdapter extends RecyclerView.Adapter&lt;NavDrawerAdapter.ViewHolder&gt; {
      private String[] mNavTitles;
      private int count;
  
      public NavDrawerAdapter(mNavTitles, mCount){
          this.mNavTitles = mNavTitles;
          this.count = mCount;
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder {
          TextView textView;
          TextView counter;
  
          public ViewHolder (View itemView) {
              textView = (TextView) itemView.findViewById(R.id.title);
              counter = (TextView) itemView.findViewById(R.id.counter);
          }
      }
  
      @Override
      public NavDrawerAdapter.ViewHolder onCreateViewHolder(ViewGroup parent) {
          View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.navdrawer_item,parent,false);
          return new ViewHolder(v);
      }
  
      @Override
      public void onBindViewHolder(NavDrawerAdapter.ViewHolder holder, int position) {
          holder.textView.setText(mNavTitles[position]);
          holder.counter.setText("" + _count);
      }
  
      @Override
      public int getItemCount() {
          return mNavTitles.length;
      }
  }
  </code></pre>
  
  <p><strong>Method 2</strong></p>
  
  <pre><code>    public class ActivityMain extends AppCompatActivity{
  
          private String[] navMenuTitles;
          private NavDrawerList navDrawerList;
  
          RecyclerView mRecyclerView;
          RecyclerView.Adapter mAdapter;
          RecyclerView.LayoutManager mLayoutManager;
          DrawerLayout mDrawerLayout;
          ActionBarDrawerToggle mDrawerToggle;
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
              navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
  
              mRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView);
              mRecyclerView.setHasFixedSize(true);
              mAdapter = new NavDrawerAdapter(new NavDrawerList(navMenuTitles, 20));
              mRecyclerView.setAdapter(mAdapter);
              mLayoutManager = new LinearLayoutManager(this);
              mRecyclerView.setLayoutManager(mLayoutManager);
              mDrawerLayout = (DrawerLayout) findViewById(R.id.DrawerLayout);
  
              mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.openDrawer, R.string.closeDrawer);
              mDrawerLayout.setDrawerListener(mDrawerToggle);
          }
  
          public void updateCount(){
              navDrawerList.setNavCount(10);
              mAdapter.notifyDataSetChanged(); // DRAWER STILL SHOWS 20 EVEN IF I CALL THIS FUNCTION
          }
      }
  
  
  
  
  
      public class NavDrawerAdapter extends RecyclerView.Adapter&lt;NavDrawerAdapter.ViewHolder&gt; {
          private String[] mNavTitles;
          private int count;
  
          public NavDrawerAdapter(mNavTitles, mCount){
              this.mNavTitles = navDrawerList.getNavTitles();
              this.count = navDrawerList.getNavCount();
          }
      }
  
  public class NavDrawerList {
      private String[] navTitles;
      private int navCount;
  
      public NavDrawerList(String[] navTitles, int navCount){
          this.navTitles = navTitles;
          this.navCount = navCount;
      }
  
      public String[] getNavTitles(){
          return navTitles;
      }
  
      public int getNavCount(){
          return navCount;
      }
  
      public void setNavCount(int navCount){
          this.navCount = navCount;
      }
  }
  </code></pre>