title: How to refresh a view in main activity from an adapter?
body: <p>I have a graph in main activity also I have a recycler view in main activity. Custom adapter is used for recyclerview. I have a check box and swipe layout in list item layout. in swipe layout there is a delete button.</p>
  
  <p>I want to reset the graph of main activity when I check the check box or when I delete any item.</p>
  
  <p>For this I created one method in main activity. And called this method in adapter onCheckedChangeListener and on click of delete.</p>
  
  <p>But I am getting a null pointer exception on mBarChart. i.e . graph. I have instantiated in mBarChart in setUI method and this is called in onCreate of an activity.</p>
  
  <p>resetMethod</p>
  
  <pre><code>    public void resetGraph(Context context)
  {
  
      mBarChart.invalidate();
  
  }
  </code></pre>
  
  <p>in adapter :</p>
  
  <pre><code>  Context conext;
    MainActivity mainActivity;
  
    mainActivity = new MainActivity();
  
    mainActivity.resetGraph(conext);
  </code></pre>
  
  <p>How to do this? Please help.. Thank you..</p>