android - Bundle size in bytes -
is there way know bundle size in bytes? point in asking saving parcelable object lists in bundle
on onsaveinstancestate
.
i need check if bundle size reached it's size limit , prevent more data saved, , prevent transactiontoolarge
exception occur.
i think easiest way me is:
fun getbundlesizeinbytes(bundle : bundle) : int { val parcel = parcel.obtain() parcel.writevalue(bundle) val bytes = parcel.marshall() parcel.recycle() return bytes.size }
Comments
Post a Comment