title: How to overwrite an integer in shared-preferences from another activity
body: <p>I want to make a stepcounter where you can manually change the amount of steps in another activity. How do I change integers stored in a sharedpreferences from another activity? 
  The original values are put in the sharedpreferences in the main_activity, than I want to use a edit_activity to manually put in values that overwrite the values in sharedpreferences.</p>
  
  <p>I tried to just overwrite it, by using the same code as in the main_activity put with other values to put in.</p>
  
  <pre><code>SharedPreferences.Editor editor = getSharedPreferences("sharedpreft", Context.MODE_PRIVATE).edit();
          int newyesterday = Integer.parseInt(yesterdayinput.getText().toString());
          editor.putInt("stepsyesterday", newyesterday);
          int newdaybeforeyesterday = Integer.parseInt(daybeforeyesterdayinput.getText().toString());
          editor.putInt("stepsdaybeforeyesterday", newdaybeforeyesterday);
          editor.apply();
  </code></pre>
  
  <p>This code doesn't results in errors but the app crashes when trying to overwrite the values. </p>
  
  <p>I also found another question that was similair, here no editor was used but only .edit and .apply. This however doesn't seem to work with integers.</p>
  
  <pre><code>SharedPreferences sharedprefs = getSharedPreferences("sharedprefs", Activity.MODE_PRIVATE);
          int newtoday = Integer.parseInt(todayinput.getText().toString());
          sharedprefs.edit("stepstoday", newtoday).apply();
  </code></pre>
  
  <p>This code results in an error saying that edit() can not be applied to (java.lang.String, Int).</p>