title: refresh fragment view after getting synch service
body: <p>I have a synch service that runs at certain interval and updates the client side according to server data. Now if user does any changes to server data like removing a item from listview then that change should reflect to that corresponding view fragment. </p>
  
  <p>The problem is - I am getting the changes in my fragment but that's not automatic. That means I have to go back and forth and come back to my relevant fragment to see my update. </p>
  
  <p>Then how should I get notified from the synch service running in the background that my corresponding fragment view is now changed so that I can call my refresh function on my 
  fragment view?</p>
  
  <p>Note: I don't want to refresh the fragment again and again at certain intervals. I only want
        refresh when my fragment view gets changed.</p>
  
  <p>UPDATE:</p>
  
  <p>I am getting the adapter count that gives the count of a list view items in a fragment.
  So whenever I gets the changed count, I need to update/refresh/reload the fragment. So my count will work as a trigger to change the fragment view.</p>
  
  <p>Its something like:</p>
  
  <pre><code>if adapter.getCount() gets changed  //how to get notified about this change
  {
          FragmentTransaction transactionOld =getActivity().getSupportFragmentManager().beginTransaction();
  
          transactionOld.detach(this).commit();
  
       FragmentTransaction transactionNew = getActivity().getSupportFragmentManager().beginTransaction();
  
          transactionNew.attach(this).commit();
  }
  </code></pre>