title: Java android ava.lang.RuntimeException: Parcelable encountered IOException writing serializable object
body: <p>I want to in finish Activity with result put a List of objets I created a class which look like this :</p>
  
  <pre><code> public class Vals implements Serializable {
      public ArrayList&lt;RowBean&gt; data;
  
      public Vals(ArrayList&lt;RowBean&gt; data) {
          this.data = data;
      }
  }
  </code></pre>
  
  <p>Next in activity (fragment) I did this when I finish my activity with result :</p>
  
  <pre><code>private void finishWithResult() {
      Bundle conData = new Bundle();
      conData.putString("param_result", counter + "");
      Intent intent = new Intent();
      intent.putExtras(conData);
      ArrayList&lt;RowBean&gt; rows = new ArrayList&lt;&gt;();
      for(RowBean row : rowBeen){
          if(row.isSelected())
              rows.add(row);
      }
      intent.putExtra(ROW_BEAN_DATA, new Vals(rows));
      getActivity().setResult(RESULT_OK, intent);
      getActivity().finish();
  }
  </code></pre>
  
  <p>And in console I have :</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.maps, PID: 10222 java.lang.RuntimeException: 
  Parcelable encountered IOException writing serializable object (name =  com.maps.Utils.Vals) at 
  android.os.Parcel.writeSerializable(Parcel.java:1316) at android.os.Parcel.writeValue(Parcel.java:1264) at android.os.Parcel.writeArrayMapInternal(Parcel.java:618) at android.os.Bundle.writeToParcel(Bundle.java:1692) at android.os.Parcel.writeBundle(Parcel.java:636) at android.content.Intent.writeToParcel(Intent.java:7582) at android.app.ActivityManagerProxy.finishActivity(ActivityManagerNative.java:2517)at android.app.Activity.finish(Activity.java:4324) at com.maps.Fragment.FragmentListOfAllObjetsToReportActivity.finishWithResult(FragmentListOfAllObjetsToReportActivity.java:156) at com.maps.Fragment.FragmentListOfAllObjetsToReportActivity.confirmChoose(FragmentListOfAllObjetsToReportActivity.java:160) at com.maps.Fragment.FragmentListOfAllObjetsToReportActivity.access$200(FragmentListOfAllObjetsToReportActivity.java:34) at com.maps.Fragment.FragmentListOfAllObjetsToReportActivity$3.onClick(FragmentListOfAllObjetsToReportActivity.java:102) at android.view.View.performClick(View.java:4640)
  </code></pre>
  
  <p>This is onActivityResult :</p>
  
  <pre><code>  @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          switch (requestCode) {
              case 90:
                  if (resultCode == RESULT_OK) {
                      Bundle res = data.getExtras();
                      String result = res.getString("param_result");
                      int count = Integer.parseInt(result);
                      if (count != 1)
                          tvChooseObjects.setText("Wybrano " + count + " obiekty");
                      else
                          tvChooseObjects.setText("Wybrano " + count + " obiekt");
                      rowBeen = ((Vals) getIntent().getSerializableExtra(FragmentListOfAllObjetsToReportActivity.ROW_BEAN_DATA)).data;
  
                      Toast.makeText(getApplicationContext(), rowBeen.size() + " " , Toast.LENGTH_LONG).show();
  
                  }
                  break;
          }
  </code></pre>