title: How to enable menu item with a click of items of recycler view?
body: <p>I have a recycler view with checkboxes in <strong>InterestsActivity</strong> and I want to enable <strong>NEXT button</strong> on the toolbar after I got at least 4 checkboxes selected.</p>
  
  <p>NEXT button is disabled in <strong>onCreateOptionsMenu</strong>(Menu menu)</p>
  
  <pre><code> @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  
      getMenuInflater().inflate(R.menu.menu_interests_button, menu);
      nextBtn = menu.findItem(R.id.action_button);
      nextBtn.setEnabled(false);
  
      return true;
  }
  </code></pre>
  
  <p>I have overridden <strong>onPrepareOptionsMenu</strong>(Menu menu) and trying to enable menu item there with a call to <strong>invalidateOptionsMenu</strong>() in onClick of my  ViewHolder item.. </p>
  
  <pre><code>@Override
  public boolean onPrepareOptionsMenu(Menu menu) {
      super.onPrepareOptionsMenu(menu);
  
      MenuItem item = menu.findItem(R.id.action_button);
      if(interestMap.size()&gt;=4)
      item.setEnabled(true);
  
      return true;
  }
  </code></pre>
  
  <p>My bind method in <strong>ViewHolder</strong></p>
  
  <pre><code>public void bind(final Topic subject) {
          interestMap=new HashMap&lt;&gt;();
          mSubjectCheckbox.setText(subject.getSubjectName());
          mSubjectCheckbox.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  interestMap.put(subject.getSubjectName(),true);
                  if(interestMap.size()&gt;=4)
                      InterestsActivity.this.invalidateOptionsMenu();
  
              }
          });
      }
  </code></pre>
  
  <p>But the button is not being enabled, am I doing right or missing anything? </p>
  
  <pre><code> @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
      int id = item.getItemId();
  
      if (id == R.id.action_button) {
          mFirebaseUtil.mFirestore.collection("users").document(FirebaseUtil.getCurrentUserId()).collection("interests").add(interestMap).addOnSuccessListener(new OnSuccessListener&lt;DocumentReference&gt;() {
              @Override
              public void onSuccess(DocumentReference documentReference) {
                  Intent setupIntent = new Intent(InterestsActivity.this, SetupActivity.class);
                  startActivity(setupIntent);
                  finish();
              }
          });
          return true;
      }
  
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>Please help me resolve this. Thanks in Advance.</p>