title: Calling notifyDataSetChanged() from inside Adapter
body: <p>My implementation of <code>ArrayAdapter</code> is such that it listens for changes in the under lying data. So any changes in the data, the adapter is notified and it calls the <code>notifydataSetChanged()</code> </p>
  
  <pre><code>public class MyAdapter extends ArrayAdapter implements ObjectStateListener {
  
      @Override
      public void onObjectStateChanged() {
          /*Call appropriate functions as the underlying data as changed.
          A good way of doing that would be to retrieve only the positions of the filtered values
          so that the original dataholder can be used but display only certain indices
           */
          Log.v(TAG, "FilterCriteria changed. Trigger fired");
          this.filterPositions = Helper().getFilteredPositions(filterCriteria, mAppartments);
  
          Log.v(TAG, "CALLING NOTIFYDATASETCHANGED()...");
          notifyDataSetChanged();
          Log.v(TAG, "FINISHED CALLING NOTIFY DATASET CHANGED");
  
      }
  }
  </code></pre>
  
  <p>In the above code the function <code>onObjectStateChanged()</code> is called whenever there is change in the data and in turn it calls <code>notifyDataSetChanged()</code>. To test if the <code>onObjectStateChanged()</code> is called correctly, I have put a bunch of Log statements as you can see. All those logs appear in logcat. But <code>getView()</code> is not getting called after calling <code>notifyDataSetChanged()</code> and hence the listview is not getting refreshed.<br><br>
  Why is this happening? <code>notifyDataSetChanged()</code> is supposed to ensure that <code>getView()</code> gets called and the new data is reflected in the ListView right?
  <br><br>
  Definition of <code>ObjectStateChangeListener</code><br><br></p>
  
  <pre><code>public interface ObjectStateListener {
  
      public void onObjectStateChanged();
      public void listenForStateChange(Object o);
  }
  </code></pre>