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

      1. <small id='2DzpH'></small><noframes id='2DzpH'>

        <legend id='2DzpH'><style id='2DzpH'><dir id='2DzpH'><q id='2DzpH'></q></dir></style></legend>
          <bdo id='2DzpH'></bdo><ul id='2DzpH'></ul>
      2. <tfoot id='2DzpH'></tfoot>

        将位图动态放入小部件时失败的活页夹事务

        Failed binder transaction when putting an bitmap dynamically in a widget(将位图动态放入小部件时失败的活页夹事务)

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

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

                    <tbody id='PibLM'></tbody>

                1. 本文介绍了将位图动态放入小部件时失败的活页夹事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  谁能告诉我失败的活页夹交易错误的原因?我可以在 logcat 中看到此错误消息.尝试将位图动态放入小部件时出现此错误...

                  Can anybody tell me the reason for failed binder transaction error? I can see this error message in logcat. I am getting this error while trying to put an bitmap dynamically in a widget...

                  推荐答案

                  这是因为对 RemoteViews 的所有更改都是序列化的(例如 setInt 和 setImageViewBitmap ).位图也被序列化成一个内部包.不幸的是,这个捆绑包的大小限制非常小.

                  This is caused because all the changes to the RemoteViews are serialised (e.g. setInt and setImageViewBitmap ). The bitmaps are also serialised into an internal bundle. Unfortunately this bundle has a very small size limit.

                  您可以通过这种方式缩小图像大小来解决它:

                  You can solve it by scaling down the image size this way:

                   public static Bitmap scaleDownBitmap(Bitmap photo, int newHeight, Context context) {
                  
                   final float densityMultiplier = context.getResources().getDisplayMetrics().density;        
                  
                   int h= (int) (newHeight*densityMultiplier);
                   int w= (int) (h * photo.getWidth()/((double) photo.getHeight()));
                  
                   photo=Bitmap.createScaledBitmap(photo, w, h, true);
                  
                   return photo;
                   }
                  

                  选择足够小的 newHeight(屏幕上的每个正方形大约为 100)并将它用于您的小部件,您的问题将得到解决:)

                  Choose newHeight to be small enough (~100 for every square it should take on the screen) and use it for your widget, and your problem will be solved :)

                  这篇关于将位图动态放入小部件时失败的活页夹事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
                  cocos2d-android: how to display score(cocos2d-android:如何显示分数)
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  • <i id='LNkQF'><tr id='LNkQF'><dt id='LNkQF'><q id='LNkQF'><span id='LNkQF'><b id='LNkQF'><form id='LNkQF'><ins id='LNkQF'></ins><ul id='LNkQF'></ul><sub id='LNkQF'></sub></form><legend id='LNkQF'></legend><bdo id='LNkQF'><pre id='LNkQF'><center id='LNkQF'></center></pre></bdo></b><th id='LNkQF'></th></span></q></dt></tr></i><div id='LNkQF'><tfoot id='LNkQF'></tfoot><dl id='LNkQF'><fieldset id='LNkQF'></fieldset></dl></div>
                    <tfoot id='LNkQF'></tfoot>

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

                          • <small id='LNkQF'></small><noframes id='LNkQF'>

                            <legend id='LNkQF'><style id='LNkQF'><dir id='LNkQF'><q id='LNkQF'></q></dir></style></legend>
                              <tbody id='LNkQF'></tbody>