title: Android array to Sharedpreferences with Gson
body: <p>I need to create an array of the last 5 call dates.</p>
  
  <p>I know that I have to save the date on the array but I don't know how to reorder the other records to keep this last call date the 1st record. And always maintain only 5 records</p>
  
  <p>The Goal is to save that last call string and add to the array, after that I reorder to and maintain only the 5 records, after that I use FlexJson to make a string and save on sharedpreferences. Anyone have this full process?</p>
  
  <p><strong>Here what I'm doing but is throwing errors everywhere:</strong></p>
  
  <p><strong>SAVE</strong></p>
  
  <pre><code>SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss dd-MM-yyyy", Locale.getDefault());
  Calendar calendar = Calendar.getInstance();
  String currentDateTimeString = df.format(calendar.getTime());
  
  List&lt;String&gt; textList = new ArrayList&lt;&gt;();
  JSONSerializer ser = new JSONSerializer();
  textList.add(currentDateTimeString);
  
  String jsonText = ser.deepSerialize(textList);
  
  editor.putString("lastCall", jsonText);
  editor.commit();
  </code></pre>
  
  <p><strong>READ:</strong></p>
  
  <pre><code>String lastCall = callLogPreferences.getString("lastCall", null);
  JSONDeserializer&lt;List&lt;String&gt;&gt; der = new JSONDeserializer&lt;&gt;();
  List&lt;String&gt; textList = der.deserialize(lastCall);
  </code></pre>
  
  <p>I'm using FlexJson: <a href="https://stackoverflow.com/questions/20447897/gson-and-instancecreator-issue/20448172#20448172">GSON and InstanceCreator issue</a></p>
  
  <p>It's not converting from string to Array List</p>