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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -