title: Android App - sharedpreferences not loading properly
body: <p>I am having issues loading the sharedpreferences. This is my first app with no prior coding experience. The app allows the user to count their number of "Drinks" and "Shots". </p>
  
  <p>The buttons increase their appropriate textView by "1". When I close the app and open it the numbers stay intact and the buttons keep increasing the value by "1". </p>
  
  <p>The problem is When the app is destroyed and opened. The textView's will show the numbers that were left, but when I press a button they rest back to 1. So, the the correct numbers are being loaded, but the buttons are resting those numbers.</p>
  
  <p>I hope this is clear enough. Please, let me know if I need to explain it better. I'm usually able to figure out all my problems through a lot of internet searches. I just finally hit a wall.</p>
  
  <pre><code>private Button clearButton;
  private Button drinkButton;
  private Button shotButton;
  private TextView textDrink;
  private TextView textShot;
  private int counterDrink = 0;
  private int counterShot = 0;
  
  public static final String DRINK_DATA = "DrinkData";
  public static final String DEFAULT = "0";
  SharedPreferences prefs;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      ...
      loadSavedPreferences();
  }
  ...
  private void loadSavedPreferences(){
      prefs = getSharedPreferences(DRINK_DATA, MODE_PRIVATE);
      String dataDrinkReturned = prefs.getString("DrinkData", DEFAULT);
      String dataShotReturned = prefs.getString("ShotData", DEFAULT);
      textDrink.setText(dataDrinkReturned);
      textShot.setText(dataShotReturned); }
  </code></pre>
  
  <p>'</p>
  
  <pre><code>@Override
  protected void onPause(){
      super.onPause();
      prefs = getSharedPreferences(DRINK_DATA, MODE_PRIVATE);
      String shotData = textShot.getText().toString();
      String drinkData = textDrink.getText().toString();
      SharedPreferences.Editor editor = prefs.edit();
      editor.putString("DrinkData", drinkData);
      editor.putString("ShotData", shotData);
      editor.commit();
  }
  </code></pre>
  
  <p>`</p>