title: Android: Adding window failed / android.os.TransactionTooLargeException on Samsung devices
body: <p>Since a couple of month I'm having a large number of exceptions in my app with the error message: Adding window failed (android.os.TransactionTooLargeException)</p>
  
  <p>I know about the IPC buffer transaction size being limited to 1024KB, but I just send ids to my service (Long value).
  What's strange is that these exceptions only occurs on Samsung devices with Android 4.4.2 (every single one of more than 50K crashes).
  Do you know a a specific bug in the latest Samsung ROM ?</p>
  
  <pre><code>    java.lang.RuntimeException: Adding window failed
         at android.view.ViewRootImpl.setView(ViewRootImpl.java:738)
         at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
         at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
         at android.widget.Toast$TN.handleShow(Toast.java:478)
         at android.widget.Toast$TN$1.run(Toast.java:374)
         at android.os.Handler.handleCallback(Handler.java:733)
         at android.os.Handler.dispatchMessage(Handler.java:95)
         at android.os.Looper.loop(Looper.java:136)
         at android.app.ActivityThread.main(ActivityThread.java:5476)
         at java.lang.reflect.Method.invokeNative(Method.java)
         at java.lang.reflect.Method.invoke(Method.java:515)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
         at dalvik.system.NativeStart.main(NativeStart.java)
  Caused by: android.os.TransactionTooLargeException
         at android.os.BinderProxy.transact(Binder.java)
         at android.view.IWindowSession$Stub$Proxy.addToDisplay(IWindowSession.java:710)
         at android.view.ViewRootImpl.setView(ViewRootImpl.java:727)
         at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
         at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
         at android.widget.Toast$TN.handleShow(Toast.java:478)
         at android.widget.Toast$TN$1.run(Toast.java:374)
         at android.os.Handler.handleCallback(Handler.java:733)
         at android.os.Handler.dispatchMessage(Handler.java:95)
         at android.os.Looper.loop(Looper.java:136)
         at android.app.ActivityThread.main(ActivityThread.java:5476)
         at java.lang.reflect.Method.invokeNative(Method.java)
         at java.lang.reflect.Method.invoke(Method.java:515)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
         at dalvik.system.NativeStart.main(NativeStart.java)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>    java.lang.RuntimeException: Adding window failed
         at android.view.ViewRootImpl.setView(ViewRootImpl.java:726)
         at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
         at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
         at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3038)
         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
         at android.app.ActivityThread.access$900(ActivityThread.java:161)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
         at android.os.Handler.dispatchMessage(Handler.java:102)
         at android.os.Looper.loop(Looper.java:157)
         at android.app.ActivityThread.main(ActivityThread.java:5356)
         at java.lang.reflect.Method.invokeNative(Method.java)
         at java.lang.reflect.Method.invoke(Method.java:515)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
         at dalvik.system.NativeStart.main(NativeStart.java)
  Caused by: android.os.TransactionTooLargeException
         at android.os.BinderProxy.transact(Binder.java)
         at android.view.IWindowSession$Stub$Proxy.addToDisplay(IWindowSession.java:710)
         at android.view.ViewRootImpl.setView(ViewRootImpl.java:715)
         at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
         at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
         at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3038)
         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
         at android.app.ActivityThread.access$900(ActivityThread.java:161)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
         at android.os.Handler.dispatchMessage(Handler.java:102)
         at android.os.Looper.loop(Looper.java:157)
         at android.app.ActivityThread.main(ActivityThread.java:5356)
         at java.lang.reflect.Method.invokeNative(Method.java)
         at java.lang.reflect.Method.invoke(Method.java:515)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
         at dalvik.system.NativeStart.main(NativeStart.java)
  </code></pre>