<small id='8Dr7x'></small><noframes id='8Dr7x'>

<tfoot id='8Dr7x'></tfoot>
    • <bdo id='8Dr7x'></bdo><ul id='8Dr7x'></ul>
    <legend id='8Dr7x'><style id='8Dr7x'><dir id='8Dr7x'><q id='8Dr7x'></q></dir></style></legend>

      <i id='8Dr7x'><tr id='8Dr7x'><dt id='8Dr7x'><q id='8Dr7x'><span id='8Dr7x'><b id='8Dr7x'><form id='8Dr7x'><ins id='8Dr7x'></ins><ul id='8Dr7x'></ul><sub id='8Dr7x'></sub></form><legend id='8Dr7x'></legend><bdo id='8Dr7x'><pre id='8Dr7x'><center id='8Dr7x'></center></pre></bdo></b><th id='8Dr7x'></th></span></q></dt></tr></i><div id='8Dr7x'><tfoot id='8Dr7x'></tfoot><dl id='8Dr7x'><fieldset id='8Dr7x'></fieldset></dl></div>
      1. AppWidgetHost 崩溃 android.os.TransactionTooLargeException

        时间:2023-09-09

        <small id='Ueeqo'></small><noframes id='Ueeqo'>

        <legend id='Ueeqo'><style id='Ueeqo'><dir id='Ueeqo'><q id='Ueeqo'></q></dir></style></legend>

            1. <i id='Ueeqo'><tr id='Ueeqo'><dt id='Ueeqo'><q id='Ueeqo'><span id='Ueeqo'><b id='Ueeqo'><form id='Ueeqo'><ins id='Ueeqo'></ins><ul id='Ueeqo'></ul><sub id='Ueeqo'></sub></form><legend id='Ueeqo'></legend><bdo id='Ueeqo'><pre id='Ueeqo'><center id='Ueeqo'></center></pre></bdo></b><th id='Ueeqo'></th></span></q></dt></tr></i><div id='Ueeqo'><tfoot id='Ueeqo'></tfoot><dl id='Ueeqo'><fieldset id='Ueeqo'></fieldset></dl></div>
                <tbody id='Ueeqo'></tbody>

                • <bdo id='Ueeqo'></bdo><ul id='Ueeqo'></ul>
                • <tfoot id='Ueeqo'></tfoot>

                  本文介绍了AppWidgetHost 崩溃 android.os.TransactionTooLargeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个自定义的 android 启动器.添加一些小部件(三星图库,收藏夹直拨)后,每次重新启动应用程序时都会崩溃.这是代码:

                  I'm working on a custom android launcher. After I add some widgets (Samsung gallery, Favourite direct dial), every time I restart the app I obtain a crash. This is the code:

                  public static final int APPWIDGET_HOST_ID = 128;
                  
                      public final class Launcher extends Activity {
                  
                      @Override
                      protected void onCreate(Bundle savedInstanceState) {
                          super.onCreate(savedInstanceState); 
                          mAppWidgetManager = AppWidgetManager.getInstance(this);
                          mAppWidgetHost = new AppWidgetHost(this, APPWIDGET_HOST_ID);
                          mAppWidgetHost.startListening(); //Here it crash
                          ...
                      }
                  }
                  

                  这是错误日志:

                      java.lang.RuntimeException: Unable to start activity ComponentInfo{custom.launcherpro/custom.launcher.launcher.Launcher}: java.lang.RuntimeException: system server dead?
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
                      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(Native Method)
                      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(Native Method)
                   Caused by: java.lang.RuntimeException: system server dead?
                      at android.appwidget.AppWidgetHost.startListening(AppWidgetHost.java:166)
                      at custom.launcher.launcher.Launcher.onCreate(Launcher.java:181)
                      at android.app.Activity.performCreate(Activity.java:5426)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
                      ... 11 more
                   Caused by: android.os.TransactionTooLargeException
                      at android.os.BinderProxy.transact(Native Method)
                      at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.startListening(IAppWidgetService.java:465)
                      at android.appwidget.AppWidgetHost.startListening(AppWidgetHost.java:162)
                  

                  这发生在 android 4.4 上(但即使在较旧的 android 版本上)这是什么意思?我该如何预防?

                  This happens on android 4.4 (but even on older android version) What does it mean? How can I prevent it?

                  谢谢你,文森佐

                  推荐答案

                  参见TransactionTooLargeException 在文档中.如果您查看 AppWidgetHost 的源代码,您会发现跟踪中提到的这段代码:

                  See TransactionTooLargeException in the docs. If you look at the source for AppWidgetHost you will find this code mentioned in your trace:

                  ArrayList<RemoteViews> updatedViews = new ArrayList<RemoteViews>();
                  // ....
                  updatedIds = sService.startListening(mCallbacks, mPackageName, mHostId, updatedViews);
                  

                  在这种情况下,updatedViews 是一个 RemoteViews 数组.如果它们包含大量图像,它们可能会非常大.你有一些带有大图像的小部件吗?

                  In this case the updatedViews is an array of RemoteViews. Those can be quite large if they contain a lot of images. Do you have some widgets with huge images in them or something?

                  这篇关于AppWidgetHost 崩溃 android.os.TransactionTooLargeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在活动和小部件之间共享数据? 下一篇:Android:从数据库中获取小部件数据

                  相关文章

                • <legend id='p9yk3'><style id='p9yk3'><dir id='p9yk3'><q id='p9yk3'></q></dir></style></legend>

                • <i id='p9yk3'><tr id='p9yk3'><dt id='p9yk3'><q id='p9yk3'><span id='p9yk3'><b id='p9yk3'><form id='p9yk3'><ins id='p9yk3'></ins><ul id='p9yk3'></ul><sub id='p9yk3'></sub></form><legend id='p9yk3'></legend><bdo id='p9yk3'><pre id='p9yk3'><center id='p9yk3'></center></pre></bdo></b><th id='p9yk3'></th></span></q></dt></tr></i><div id='p9yk3'><tfoot id='p9yk3'></tfoot><dl id='p9yk3'><fieldset id='p9yk3'></fieldset></dl></div>

                  <small id='p9yk3'></small><noframes id='p9yk3'>

                  <tfoot id='p9yk3'></tfoot>

                        <bdo id='p9yk3'></bdo><ul id='p9yk3'></ul>