JavaBinder: !!! FAILED BINDER TRANSACTION !!!

蒋招
2023-12-01

android开发过程中,我遇到了这样的一个不明确的异常提示!!! FAILED BINDER TRANSACTION !!!,什么通讯失败?

在网上搜索答案时,看到最多的答案是:出现这个问题的原因是我在两个Activity之间使用Intent传递过大的Bitmap才出现的,用Intent传bitmap不能大于40KB,否则就会出现这个情况(https://developer.android.com/reference/android/os/TransactionTooLargeException)。

但是我并没有通过Intent传bitmap,只是在自定义的view里保存当前view的状态,然后恢复,其对象是bitmap。其代码如下:

@Override
    protected Parcelable onSaveInstanceState() {
        Bundle bundle = new Bundle();
        bundle.putParcelable("superState", super.onSaveInstanceState());
        if(this.mHasEditState == null || this.mHasEditState){
            // 这里返回需要保存bitmap的对象
            this.mBitmapSavedState = this.getTransparentSignatureBitmap();
        }
        bundle.putParcelable("signatureBitmap", this.mBitmapSavedState);
        return bundle;
    }

我这里并没有使用Intent,而是使用的Bundle,这样也会出现标题的错误,把这部分给注释之后就好了。或者也可以按照网上说的建一个全局的类保存这个对象。

 类似资料:

相关阅读

相关文章

相关问答