title: Refresh current activity in Xamarin
body: <p>I am new to Xamarin and I am trying to refresh my <code>MainActivity</code> from itself. I read a lot of forums about that but I still can't find any solution. My problem is that I need to do the refreshing from another method, not within the <code>onCreate()</code> method.</p>
  
  <p>My <code>MainActivity</code> is a <code>listview</code> and I want to reload the whole activity in order to refresh the listview. I need to reload the whole activity because in my situation I can't use <code>NotifyDataSetChanged()</code> because the changes I am making to the <code>listview</code> are not within the <code>onCreate()</code> method and not in a new activity neither. I have a CAB menu from where the user has the option to delete selected note from the listview. I am using the <code>NotifyDataSetChanged()</code> method in my <code>onResume()</code> method and it's working perfectly when I am making the changes to my <code>listview</code> in another activity but it's not working when I am making them from the current activity because then the <code>onResume()</code> method is not being called .</p>
  
  <p>I've tried doing it like this:</p>
  
  <pre><code>Intent refresh = new Intent(this,typeof(MainActivity));
  refresh.AddFlags(ActivityFlags.NoAnimation);
  Finish();
  StartActivity(refresh);
  </code></pre>
  
  <p>but it's giving me <code>NullPointerException</code> on the first row already .. And the exception I think is the "this". So I tried it differently : instead of using "this" I am using - <code>Intent refresh = new Intent(context ,typeof(MainActivity));</code> where context=this in the <code>onCreate()</code> method. But in this way it's still giving me a <code>NullPointerException</code> but this time on the row - <code>StartActivity(refresh)</code> ..</p>
  
  <p>Thanks in advance ! :)</p>