title: Sane way to go from ArrayList<Long> through an Intent
body: <p>I'm currently writing an app that pulls an array of longs from a server via json, and then passes that list from one activity into another.  The basic skeleton looks like this:</p>
  
  <pre><code>public void onResponse(Map result)
  {
      ArrayList handles= (ArrayList)result.get("fileHandles");
  
      Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
      intent.putExtra("handles", handles);
  }
  </code></pre>
  
  <p>So the first problem becomes evident, the only methods for putExtra are <code>putIntegerArrayListExtra</code>, <code>putStringArrayListExtra</code>, <code>putCharSequenceArrayListExtra</code>, and <code>putParcelableArrayListExtra</code>.  Thinking Long would probably be parcelable, I was wrong it doesn't work (even if I use <code>ArrayList&lt;Long&gt;</code>).  Next I thought I'd just pass a long [], however I see no straight-forward conversion to go from <code>ArrayList&lt;Long&gt;</code> to long [] that <code>intent.putExtra</code> will accept.  This was the solution I finally ended up with:</p>
  
  <pre><code>ArrayList handles= (ArrayList)result.get("fileHandles");
  long [] handleArray = new long[handles.size()];
  for (int i = 0; i &lt; handles.size(); i++)
  {
      handleArray[i] = Long.parseLong(handles.get(i).toString());
  }
  </code></pre>
  
  <p>Obviously this seemed a little bit ridiculous to me, but every other conversion I tried seemed to complain for one reason or another.  I've thought about re-thinking my serialization to have the problem taken care of before I get to this point, but I find it odd that passing <code>ArrayList&lt;Long&gt;</code> from activity to activity could be so difficult.  Is there a more obvious solution I'm missing?</p>