title: Not able to implement "Recently Played" playlist in music player
body: <p>I'm trying to implement "Recently Played" playlist in my music player that shows those songs which were played by user recently(in a recyclerView). But what I code does is, it only stores the last  played song.</p>
  
  <p>What I want: 
  If I have 2 songs in my music player say, A and B. I played song A first. Then it should be added to recently played list(at first position). After that if I play song B, it also should be added to list(not replacing A)but pushing A down and B occupying first position. So the final list should look like : B on the top and A below it.</p>
  
  <p>But what my app does:
  ONly stores the last played and replaces anything else i.e after song A is played if I play song B, song A will be replaced by song B and there will only be one song in the list.</p>
  
  <p>Finally my problem is as mentioned above, app only stores one song (the last played). BTW I'm using sharedpreference for this.</p>
  
  <p>Code:</p>
  
  <pre><code> public void storeAudioPlaylist(SongInfoModel songInfoModel) {
      preferences = context.getSharedPreferences(STORAGE, 
   Context.MODE_PRIVATE);
      SharedPreferences.Editor editor = preferences.edit();
      Gson gson = new Gson();
      playlistStore.add(songInfoModel);
      String json = gson.toJson(playlistStore);
      editor.putString("audioPlayList", json);
      editor.apply();
  }
  
   public ArrayList&lt;SongInfoModel&gt; loadAudioPlaylist() {
      preferences = context.getSharedPreferences(STORAGE, 
  Context.MODE_PRIVATE);
      Gson gson = new Gson();
      String json = preferences.getString("audioPlayList", null);
      Type type = new TypeToken&lt;ArrayList&lt;SongInfoModel&gt;&gt;() {
      }.getType();
      return gson.fromJson(json, type);
  }
  </code></pre>
  
  <p>The above 2 functions are used for storing song object to array and retrieving the  array respectively.</p>
  
  <p>Code :</p>
  
  <pre><code>  public void onClickListener(SongInfoModel song, int position) {
  
  storageUtil.storeAudioPlaylist(song); // this calls the method and passes 
                                           the song model(ID,name,artist..etc)
  
  
     }
  </code></pre>