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

Popular posts from this blog

Ansible warning on jinja2 braces on when -

Parsing a protocol message from Go by Java -

javascript - Replicate keyboard event with html button -