title: Android: Most efficient way to save a list of int
body: <p>I'm trying to  create a system to save the list of levels that have already been played in my application.</p>
  
  <p>I've been using Editor and SharedPreferences to store information on the phone.</p>
  
  <p>But now I have a list of int to save </p>
  
  <p>I've been trying to figure out something with </p>
  
  <pre><code> DataOutputStream out;
  
          //Size
          int resultSize = results.size();
          out.writeInt(resultSize);
  
          //All the levels ID
          for (int idx = 0; idx &lt; resultSize; idx++){
              //l().debug("Lvl ID: "+results.get(idx));
              out.writeInt(results.get(idx));
          }
  </code></pre>
  
  <p>But then I don't know how to store this in the shared preferences.</p>
  
  <p>I'm also concerned about size, this list of ID might get really big so I want to optimize the amount stored.(hence the DataStream)</p>
  
  <p>any ideas</p>
  
  <p>Jason</p>