title: Shared preferences not working correctly
body: <p>I'm trying to store some strings in a shared preference file and then retrieve them in another activity, except it doesn't seem to be working. Any guidance as to where im going wrong would be much appreciated. Many thanks.</p>
  
  <pre><code>public void save(View view) {
      SavePreferences("name", nameS);
      SavePreferences("current", currentS);
      SavePreferences("goal", goalS);
      SavePreferences("CurrentBmi", cBmiS);
      SavePreferences("goalBmi", gBmiS);
      Toast.makeText(this, "profile Saved", Toast.LENGTH_SHORT).show();
      startActivity(new Intent(this, MainActivity.class));
  
  }
  
  private void SavePreferences(String key, String value) {
      SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
      SharedPreferences.Editor editor = sharedPreferences.edit();
      editor.putString(key, value);
      editor.commit();
  }
  
  
  
  
  
  
   public class Progress extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_progress);
      SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
      String test = sharedPreferences.getString("name", "");
      String test2 = sharedPreferences.getString("current", "");
      TextView testy = (TextView) findViewById(R.id.textView1);
      testy.setText(test);
      TextView testz = (TextView) findViewById(R.id.test2);
      testz.setText(test2);
  }
  </code></pre>