title: How do I know how big to make my array for Parcel.readStringArray()?
body: <p>I'm getting a null pointer exception when I do this:</p>
  
  <pre><code>    private String[] foo;
  
      private void readFromParcel(Parcel in) {
          in.readStringArray(foo);
      }
  </code></pre>
  
  <p>It seems I need to allocate the array first.  But how do I know how big to make it?  Do I have to write the size first and then read the size first?  And isn't the point of having a <code>writeStringArray()</code> method to handle this for me?</p>
  
  <p>From the <a href="http://developer.android.com/reference/android/os/Parcel.html" rel="nofollow">Android Documentation</a>:</p>
  
  <blockquote>
    <p>There are a variety of methods for reading and writing raw arrays of primitive objects, which generally result in writing a 4-byte length followed by the primitive data items.</p>
  </blockquote>
  
  <p>So, if I write the count myself, it's getting written twice.  There must be some way of doing this where I am not responsible for managing this.</p>