'Android crashes after signaturepad

I am building an android app with two activities. The first activity has 50 Fields ( textinputedittext, radiobuttons and toggle buttons). I am saving the data of those fields in a json file and then I navigate to my second activity where the user cab draw its signature on this signature pad:

https://github.com/gcacace/android-signaturepad

I save the singature on a jpg image and return back to the first activity. So far so good.

Now when I try to take a second signature from my second activity, my app crashes when I return back again to my first activity, with the following stack trace:

2022-04-28 18:16:19.835 5877-6821/com.mainsys.mnsblooddonor E/libc: Access denied finding property "vendor.mali.config"
2022-04-28 18:16:22.055 5877-6821/com.mainsys.mnsblooddonor E/libc: Access denied finding property "persist.vendor.sf.fbc"
2022-04-28 18:16:22.055 5877-6821/com.mainsys.mnsblooddonor E/libc: Access denied finding property "persist.vendor.gpu.fbc"
2022-04-28 18:16:22.055 5877-6821/com.mainsys.mnsblooddonor E/libc: Access denied finding property "persist.vendor.vsp.fbc"
2022-04-28 18:16:29.331 5877-5877/com.mainsys.mnsblooddonor E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 2883332)
2022-04-28 18:16:29.340 5877-5877/com.mainsys.mnsblooddonor E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mainsys.mnsblooddonor, PID: 5877
    java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 2883332 bytes
        at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:161)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:247)
        at android.app.ActivityThread.main(ActivityThread.java:8676)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
     Caused by: android.os.TransactionTooLargeException: data parcel size 2883332 bytes
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(BinderProxy.java:605)
        at android.app.IActivityTaskManager$Stub$Proxy.activityStopped(IActivityTaskManager.java:5185)
        at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:145)
        at android.os.Handler.handleCallback(Handler.java:938) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:247) 
        at android.app.ActivityThread.main(ActivityThread.java:8676) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 

I can see that parcelable is to large but I only pass a string ( a filename ) from one activity to other. I can not understand what is this big parcel that crashes my application.

Any help is appreciated.



Solution 1:[1]

You must be passing a long string with Bundle like this and you have to clear the Bundle where you are receiving data. You can use whatever way thinks good.

1.Method:

Bundle bundle = new Bundle();
bundle.putString("This is just for testing purpose add your data key", "your string");

To clear bundle object on Fragment

  @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) 
    {
        String recStr= bundle.get("This is just for testing purpose add your data key");       
        bundle.clear();   
    }

2.Method

@Override
protected void onSaveInstanceState(Bundle oldInstanceState) 
{
    super.onSaveInstanceState(oldInstanceState);
    oldInstanceState.clear();
}

Try like this as per your requiremnts.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sandesh KhutalSaheb