title: Passing ArrayList of objects through intent - Java (Android)
body: <p>I am trying to pass an ArrayList of objects through an intent but cannot get it to work.  Here is what I have:</p>
  
  <pre><code>public class QuestionView extends Activity {
  
      //variables and other methods...
  
      public void endQuiz() {
          Intent intent = new Intent(QuestionView.this, Results.class);
          intent.putExtra("correctAnswers", correctAnswers);
          intent.putExtra("wrongAnswers", wrongAnswers);
          intent.putParcelableArrayListExtra("queries", queries);
          startActivity(intent);
      }
  }
  </code></pre>
  
  <p>Intents are being received here:</p>
  
  <pre><code>public class Results extends Activity {
  
      int cAnswers;
      int wAnswers;
      ArrayList&lt;Question&gt; qs;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.resultsmain);
  
          cAnswers = getIntent().getIntExtra("correctAnswers", -1);
          wAnswers = getIntent().getIntExtra("wrongAnswers", -1);
  
          qs = getIntent().getParcelableArrayListExtra("queries");
  
                      //more code...
      }
  }
  </code></pre>
  
  <p>The two ints, correctAnswer and wrongAnswers, are being received and I can use them.  The ArrrayList is not coming through.  No errors on in the endQuiz() method but the 'qs = getIntent().getParcelableArrayListExtra("queries");' is throwing an error and saying "Bound Mismatch."</p>
  
  <p>Any help on this is appreciated!</p>
  
  <p>Question class:</p>
  
  <pre><code>public class Question {
      String a1;
      String a2;
      String a3;
      String a4;
      int correctAnswer;
      String query;
      int selectedAnswer;
      boolean correctness;
  
      public Question() {
      }
  
      public Question(String a1, String a2, String a3, String a4, int correctAnswer, String query, int selectedAnswer, boolean correctness) {
          this.a1 = a1;
          this.a2 = a2;
          this.a3 = a3;
          this.a4 = a4;
          this.correctAnswer = correctAnswer;
          this.query = query;
          this.selectedAnswer = selectedAnswer;
          this.correctness = correctness;
      }
      }
  </code></pre>