title: SharedPreferences Saving
body: <p>I am creating an app where the user can change the source image of several ImageButtons, and I am saving these in SharedPreferences. Here are my methods for getting and saving the images:</p>
  
  <pre><code>public int getImage(String item){
          SharedPreferences pref = getActivity().getPreferences(Context.MODE_PRIVATE);
          int id = pref.getInt(item, R.drawable.no_item);
          return id;
      }
  
  public void saveImage(String item, int resourceId){
          SharedPreferences starterSP = getActivity().getPreferences(Context.MODE_PRIVATE);
          SharedPreferences.Editor edit = starterSP.edit();
          edit.putInt(item, resourceId);
          edit.apply();
      }
  </code></pre>
  
  <p>These images are stored as Drawable ID's, which are stored as integers. </p>
  
  <p>However, when I add a new image file to my drawable folder and relaunch the app, all of my existing ImageButton sources are changed to some other image in my Drawable folder. How can I prevent this from happening?</p>