title: Intent from AsyncTask startActivity not working (FAILED BINDER TRANSACTION)
body: <p>I have the following <code>AsyncTask</code>. In the onPostExecute method I am trying to start another activity using the Intent. However, I noticed that the new activity doesn't start and the <code>finish()</code> line is simply called closing the current activity. I do not know what the cause of this can be.  </p>
  
  <pre><code>   private void uploadImage(final String city, final String offset, final int currImage, final View itemView, final Animation animation) {
      class UploadImage extends AsyncTask&lt;String, Void, String&gt; {
          private Context context;
  
          public UploadImage(Context context){
              this.context=context;
          }
        //  ProgressDialog loading;
          RequestHandler rh = new RequestHandler();
  
          @Override
          protected String doInBackground(String... params) {
              HashMap&lt;String, String&gt; data = new HashMap&lt;&gt;();
              data.put("city", city);
              data.put("offset",offset);
              String result = rh.sendPostRequest(SL_URL, data);
  
              return result;
          }
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              //loading = ProgressDialog.show(SlideShow.this, "Uploading Image", "Please wait...", true, true);
          }
  
          @Override
          protected void onPostExecute(String s) {
              super.onPostExecute(s);
             // loading.dismiss();
              JSONArray jsonArray = null;
              try {
                  jsonArray = new JSONArray(s);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              for (int i = 0; i &lt; jsonArray.length(); i++) {
                  try {
                      JSONObject a = jsonArray.getJSONObject(i);
                      imageDisplayerArrayList.add(new ImageDisplayer(a.getString("user_id"),a.getString("image"),a.getString("longitude"),a.getString("latitude"),a.getString("city"),a.getString("geo_name_id"),a.getString("description"),a.getString("score"),a.getString("Categories")));
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
              itemView.clearAnimation();
              itemView.setVisibility(View.INVISIBLE);
              if (imageDisplayerArrayList.size() &gt; 0) {
                  Intent intent = new Intent(context, SlideShow.class);
                  intent.putExtra("key",imageDisplayerArrayList);
                  intent.putExtra("city", city);
                  context.startActivity(intent);
                  ((Activity) context).finish();
              }
              else {
                  Toast.makeText(getApplicationContext(), "No new content available", Toast.LENGTH_LONG)
                          .show();                }
  
  
  
          }}
      UploadImage ui = new UploadImage(this);
      ui.execute(city);
  
  
  }
  </code></pre>
  
  <p>PARCELABLE IMAGEDISPLAYER CLASS: </p>
  
  <pre><code>public class ImageDisplayer implements Parcelable {
  private String user_id;
  private String image;
  private String longitude;
  
  private ImageDisplayer(Parcel in) {
      this.user_id = in.readString();
      this.image = in.readString();
      this.longitude = in.readString();
      this.latitude = in.readString();
      this.city = in.readString();
      this.geo_name_id = in.readString();
      this.description = in.readString();
      this.score = in.readString();
      this.categories = in.readString();
  }
  public ImageDisplayer(String user_id, String image, String longitude, String latitude, String city, String geo_name_id, String description, String score, String categories) {
      this.user_id = user_id;
      this.image = image;
      this.longitude = longitude;
      this.latitude = latitude;
      this.city = city;
      this.geo_name_id = geo_name_id;
      this.description = description;
      this.score = score;
      this.categories = categories;
  }
  
  public String getUser_id() {
  
      return user_id;
  }
  
  public void setUser_id(String user_id) {
      this.user_id = user_id;
  }
  
  public String getImage() {
      return image;
  }
  
  public void setImage(String image) {
      this.image = image;
  }
  
  public String getLongitude() {
      return longitude;
  }
  
  public void setLongitude(String longitude) {
      this.longitude = longitude;
  }
  
  public String getLatitude() {
      return latitude;
  }
  
  public void setLatitude(String latitude) {
      this.latitude = latitude;
  }
  
  public String getCity() {
      return city;
  }
  
  public void setCity(String city) {
      this.city = city;
  }
  
  public String getGeo_name_id() {
      return geo_name_id;
  }
  
  public void setGeo_name_id(String geo_name_id) {
      this.geo_name_id = geo_name_id;
  }
  
  public String getDescription() {
      return description;
  }
  
  public void setDescription(String description) {
      this.description = description;
  }
  
  public String getScore() {
      return score;
  }
  
  public void setScore(String score) {
      this.score = score;
  }
  
  public String getCategories() {
      return categories;
  }
  
  public void setCategories(String categories) {
      this.categories = categories;
  }
  
  private String latitude;
  private String city;
  private String geo_name_id;
  private String description;
  private String score;
  private String categories;
  
  @Override
  public int describeContents() {
      return 0;
  }
  
  @Override
  public void writeToParcel(Parcel dest, int flags) {
      dest.writeString(user_id);
      dest.writeString(image);
      dest.writeString(longitude);
      dest.writeString(latitude);
      dest.writeString(city);
      dest.writeString(geo_name_id);
      dest.writeString(description);
      dest.writeString(score);
      dest.writeString(categories);
  
  }
  public static final Parcelable.Creator&lt;ImageDisplayer&gt; CREATOR
          = new Parcelable.Creator&lt;ImageDisplayer&gt;() {
  
      // This simply calls our new constructor (typically private) and
      // passes along the unmarshalled `Parcel`, and then returns the new object!
      @Override
      public ImageDisplayer createFromParcel(Parcel in) {
          return new ImageDisplayer(in);
      }
  
      // We just need to copy this and change the type to match our class.
      @Override
      public ImageDisplayer[] newArray(int size) {
          return new ImageDisplayer[size];
      }
  };
  </code></pre>
  
  <p>}</p>
  
  <p>SLIDESHOW</p>
  
  <pre><code>public class SlideShow extends Activity {
  
  private ArrayList&lt;ImageDisplayer&gt; imageDisplayerArrayList = new ArrayList&lt;&gt;();
  private String city;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_slide_show);
      imageDisplayerArrayList = getIntent().getParcelableExtra("key");
      TextView time_rem = (TextView) findViewById(R.id.time_rem);
      time_rem.bringToFront();
      city = getIntent().getStringExtra("city");
      slideshow(imageDisplayerArrayList, 0, 0);
  }
  
  
  private void uploadImage2(final String city, final String offset, final int currImage) {
      class UploadImage extends AsyncTask&lt;String, Void, String&gt; {
  
          //ProgressDialog loading;
          RequestHandler rh = new RequestHandler();
  
          @Override
          protected String doInBackground(String... params) {
              HashMap&lt;String, String&gt; data = new HashMap&lt;&gt;();
              data.put("city", city);
              data.put("offset",offset);
              String result = rh.sendPostRequest(SL_URL, data);
  
              return result;
          }
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
             // loading = ProgressDialog.show(SlideShow.this, "Uploading Image", "Please wait...", true, true);
          }
  
          @Override
          protected void onPostExecute(String s) {
              super.onPostExecute(s);
            //  loading.dismiss();
              JSONArray jsonArray = null;
              try {
                  jsonArray = new JSONArray(s);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              for (int i = 0; i &lt; jsonArray.length(); i++) {
                  try {
                      JSONObject a = jsonArray.getJSONObject(i);
                      imageDisplayerArrayList.add(new ImageDisplayer(a.getString("user_id"),a.getString("image"),a.getString("longitude"),a.getString("latitude"),a.getString("city"),a.getString("geo_name_id"),a.getString("description"),a.getString("score"),a.getString("Categories")));
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
  
  
          }}
      UploadImage ui = new UploadImage();
      ui.execute(city);
  
  
  }
  
  public Bitmap ConvertToImage(String image){
          byte[] decodedByte = Base64.decode(image, 0);
          return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);
      }
  
  public void slideshow(ArrayList&lt;ImageDisplayer&gt; a, final int currImage, final int offset) {
      ImageView imageView = (ImageView) findViewById(R.id.picturedisplay);
      int currphoto = 0;
  
      final long DELAY = 300; // milliseconds
      final long VIEW_TIME = 10000;
      Timer timer = new Timer();
      final TimerTask update_time = new TimerTask() {
          @Override
          public void run() {
              SlideShow.this.runOnUiThread(new Runnable() {
                  @Override
                  public void run() {
                      TextView time_rem = (TextView) findViewById(R.id.time_rem);
                      int timeRem = Integer.parseInt(time_rem.getText().toString());
                      timeRem--;
                      time_rem.setText(Integer.toString(timeRem));
                  }});
          }};
      timer.scheduleAtFixedRate(
              new TimerTask() {
                  int i = currImage;
                  int off = 0;
                  @Override
                  public void run() {
                      SlideShow.this.runOnUiThread(new Runnable() {
                          @Override
                          public void run() {
                              if (i &lt; imageDisplayerArrayList.size()) {
                                  TextView time_rem = (TextView) findViewById(R.id.time_rem);
                                  time_rem.setText("10");
                                  Bitmap myBitmap = ConvertToImage(imageDisplayerArrayList.get(i).getImage());
                                  ImageView imageView = (ImageView) findViewById(R.id.picturedisplay);
                                  imageView.setImageBitmap(myBitmap);
                                  imageView.setScaleType(ImageView.ScaleType.FIT_XY);
                                  Toast.makeText(getApplicationContext(),
                                  Integer.toString(imageDisplayerArrayList.size()), Toast.LENGTH_LONG)
                                 .show();
                                  i++;
                                  off = (int)(Math.rint(Math.ceil((double) i / 10) * 10));
                                  if (i % 5 == 0 &amp;&amp; i % 10 != 0) {
                                      uploadImage2(city,Integer.toString(off),i);
                                  }
                              }
                              else {
                                  update_time.cancel();
                                  Intent i = new Intent(SlideShow.this,ViewScreen.class);
                                  startActivity(i);
                                  finish();
                              }
                                                                    }});
                  }
  
  
              },
              DELAY,VIEW_TIME
      );
      timer.scheduleAtFixedRate(update_time, 0, 1000);
  
  }
  
  }
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>This is caused by the following error <code>FAILED BINDER TRANSACTION !!!</code> as my image arraylist exceeds the 1MB limit. Can someone please help me create an alternative solution to passing this arraylist between the two activities?</p>