title: Force sending data using SharedPreferences( fragment to fragment in PagerAdapter)
body: <p>I'm using <code>SharedPreferences</code> to store and send data from a fragment to 4 other fragments, but my problem is when the app is running and I send the data on click button it takes the other fragments sometime to actually receive the data ( or when swipe through the pages after 3 or 4 swipes they update) I have tried <code>setUserVisibleHint</code>in each fragment and <code>onpagechangelistener</code> in the activity but nothing changes. How can I make the other fragments to recieve the data as I swipe to the pages or as I press the button?</p>
  
  <p><strong>note:</strong> I don't want to put buttons in each fragment to load the data.</p>
  
  <p><strong>sender:</strong></p>
  
  <pre><code>   int riddle;
     Context context = getActivity();
     SharedPreferences SU = context.getSharedPreferences(
                          "Riddle", Context.MODE_PRIVATE);
     SharedPreferences.Editor editor= SU.edit();
     editor.putString("Riddle",""+riddle);
     editor.commit();
  </code></pre>
  
  <p><strong>other fragments:</strong></p>
  
  <pre><code>      int Riddle;
        Context context = getActivity();
        SharedPreferences SU = context.getSharedPreferences(
                  "Riddle", Context.MODE_PRIVATE);
        Riddle=  Integer.parseInt(SU.getString("riddle",""));
  </code></pre>
  
  <p><strong>UPDATE</strong>
   I made a mistake in the original post , the sender should be:</p>
  
  <pre><code>    int riddle;
     Context context = getActivity();
     SharedPreferences SU = context.getSharedPreferences(
                          "Riddle", Context.MODE_PRIVATE);
     SharedPreferences.Editor editor= SU.edit();
     editor.putString("riddle",""+riddle);
     editor.commit();
  </code></pre>
  
  <p>because of the key thing. </p>
  
  <p>one problem remains, the fragment im sending the data from is the last page(page 5) and when i send the data , the page next to it (page 4) doesnt update till i swipe to page 3 and come back to it</p>