Problem Description:

Intent Intent = new Intent(Activity A.this, Activity B.class);

intent.putExtra(“abc”, bitmap);

If the bitmap above is too large, for example, if the bitmap exceeds 1M, it will crash, and Activity B’s onCreate will not be executed.

Solutions:

Write to a temporary file or database and send the file or database to the destination through the Uri through the FileProvider. This is generally applicable to different processes, such as UI and background services for separate processes, or between different apps. The reason for using FileProvider is that after 7.0, there are strict permission checks for sharing this App file.

Data exchange is performed by setting static variables in static classes. Generally within the same process, there is essentially only one copy of the data in memory, passed through static classes. It should be noted that Data proofreading is carried out to prevent Data display chaos caused by multi-threaded Data Racer.

Expanded description:

The official document has mentioned that the anomaly is TransactionTooLargeException, transfer data or abnormal data is too large. And the sentence “Parcel objects stored in the Binder transaction buffer” is mentioned, This indicates that the underlying parcel object actually holds a place called the Binder Transaction Buffer between activities, which must have a size limit.


Reference Documents:

http://www.sohu.com/a/302225299_611601