如果Binder的参数或返回值太大,不适合的事务缓冲区,然后调用将失败,并将被抛出TransactionTooLargeException
参考:http://developer.android.com/reference/android/os/TransactionTooLargeException.html
The Binder transaction failed because it was too large.
During a remote procedure call, the arguments and the return value of the call are transferred as Parcel
objects stored in the Binder transaction buffer. If the arguments or the return value are too large to fit in the transaction buffer, then the call will fail and TransactionTooLargeException
will be thrown.
The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.
There are two possible outcomes when a remote procedure call throws TransactionTooLargeException
. Either the client was unable to send its request to the service (most likely if the arguments were too large to fit in the transaction buffer), or the service was unable to send its response back to the client (most likely if the return value was too large to fit in the transaction buffer). It is not possible to tell which of these outcomes actually occurred. The client should assume that a partial failure occurred.
The key to avoiding TransactionTooLargeException
is to keep all transactions relatively small. Try to minimize the amount of memory needed to create aParcel
for the arguments and the return value of the remote procedure call. Avoid transferring huge arrays of strings or large bitmaps. If possible, try to break up big requests into smaller pieces.
If you are implementing a service, it may help to impose size or complexity contraints on the queries that clients can perform. For example, if the result set could become large, then don't allow the client to request more than a few records at a time. Alternately, instead of returning all of the available data all at once, return the essential information first and make the client ask for additional information later as needed
捐助开发者
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。
谢谢您的赞助,我会做的更好!
相关推荐
android Intent例子源码android Intent例子源码android Intent例子源码android Intent例子源码android Intent例子源码android Intent例子源码
前言 在sendBroadcast,startActivity时,我们会用到Intent。 Intent可以携带一些数据,比如基本类型数据...使用Intent传送数据时,可能会出现异常 在Intent中传入一个Parcelable对象;例如传入一个bitmap对象。 代
android activityIntent 传值 传对象
android Intent传递对象数据 通过对象分别实现Serializable Parcelable接口的两种方法
android intent 生命周期详解和源码
Android Intent多种传值方式 https://blog.csdn.net/qq_31939617/article/details/80742103
android intent service 实例android intent service 实例android intent service 实例
Intent在Android应用开发中,占有很大的分量,关于Intent在Android中的作用在网络上已经有很多资料了,这里不再累赘,本人喜欢直来直去。在网上看到很多关于Intent的资料,说那么多,你也许还是一头雾水,到底如何...
通过一个实验,讲解Android的使用方法,总结详细
intent 传递对象,主要是通过intent传递自定义对象
android intent 介绍
主要是intent的内部工作 原理介绍,包含详细的流程图;
经典的android intent 窗口切换 窗口打开,A窗口打开B窜
Android应用源码之Intent1_Intent
android用于打开各种文件的intent
Android编程之Intent_TabHost源码演示,自定义的Tabhost(内含源码),学习制作Android软件的TAB标签界面,在电脑上已经很流行的功能,Android手机上当然不能少,这个TabHost源码相对简单些,是JAVA转学Android比较...
Intent跳转工具类 1.用单例模式打开一个Activity并关闭当前页面,可携带数据 2.用Result的方式跳转到指定页面,不携带数据 3.跳转至主页,并附带动画 4.跳转到发送短信界面 5.跳转到拨号界面
Android Intent 学习笔记
intent是Intent对象, 它包含了需要做的操作的描述, 或者, 对于广播来说, 包含了正在通知的消息内容. 对于向这三种组件发送intent有不同的机制: 使用Context.startActivity() 或 Activity.startActivityForResult...
Android使用Intent实现Video功能