Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 3550
Alex Hales
  • 0
Alex HalesTeacher
Asked: June 2, 20222022-06-02T18:53:14+00:00 2022-06-02T18:53:14+00:00

android – onSavedInstanceState TransactionTooLargeException (only on lock screen or start activity not on rotate screen)

  • 0

[ad_1]

I’m facing an issue on the Activity Lifecycle when onSavedInstanceState is Called.

Let me explain :
I have 4 Fragments on ViewPager hosting RecyclerViews.
These RecyclerViews display data from HashMap<String, AMedia>().

The HashMap can be large, when I rotate the phone (portrait/landscape) the onSavedInstanceState and on onViewStateRestored are called and data are well transmitted by the Framework on the UI like following :

@Override
    public void onSaveInstanceState(@NonNull Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putSerializable("medias", mMapMedias);
    }

    @SuppressWarnings("unchecked")
    @Override
    public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
        super.onViewStateRestored(savedInstanceState);
        if (savedInstanceState != null) {
            mMapMedias = (HashMap<String, ArrayList<AMedia>>) savedInstanceState.getSerializable("medias");
            render();
        }
    }

But when I lock or start an other activity the phone only onSaveInstanceState and app begins crash on the lock screen with error :

JNI critical lock held for 29.211ms on Thread[1,tid=27712,Runnable,Thread*=0xb400007388322010,peer=0x73356338,"main"]
JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 45037652)
W/ActivityStopInfo: Bundle stats:
ActivityStopInfo:   android:viewHierarchyState [size=1036]
JNI critical lock held for 128.524ms on Thread[1,tid=27712,Runnable,Thread*=0xb400007388322010,peer=0x73356338,"main"]
ActivityStopInfo:   androidx.lifecycle.BundlableSavedStateRegistry.key [size=45035172]
ActivityStopInfo:     android:support:activity-result [size=2908]
ActivityStopInfo:       KEY_COMPONENT_ACTIVITY_REGISTERED_KEYS [size=2192]
JNI critical lock held for 88.565ms on Thread[1,tid=27712,Runnable,Thread*=0xb400007388322010,peer=0x73356338,"main"]
ActivityStopInfo:     android:support:fragments [size=45032008]
JNI critical lock held for 86.960ms on Thread[1,tid=27712,Runnable,Thread*=0xb400007388322010,peer=0x73356338,"main"]
ActivityStopInfo:       android:support:fragments [size=45031936]
ActivityStopInfo: PersistableBundle stats:
W/ActivityStopInfo:   [null]
AndroidRuntime: Shutting down VM
    
    --------- beginning of crash
AndroidRuntime: FATAL EXCEPTION: main
    PID: 27712
    java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 45037652 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:233)
        at android.app.ActivityThread.main(ActivityThread.java:8010)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
     Caused by: android.os.TransactionTooLargeException: data parcel size 45037652 bytes
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(BinderProxy.java:591)
        at android.app.IActivityTaskManager$Stub$Proxy.activityStopped(IActivityTaskManager.java:4408)
        at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:145)

I think on rotate the same calls are done through JavaBinder but not crashing, why on Lock or start an other activity it crashs ?

Any solution ? I’m testing on Android 12.

[ad_2]

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 8057 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 1842 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 1925 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.