Bridge always need android state library to support with
AparnaKS opened this issue · comments
I am not using any android state library like icepick as saved state handler. But was directly keeping data to bundle using putParcelable, putByteArray etc. In this case how to use bridge library. I have integrated your library and for test purpose added data to bundle (like savedInstanceState.putByteArray("bytes", new byte[1000 * 1000]);) and have used Bridge to save my bundle eg Bridge.saveInstanceState(this, savedInstanceState);
When i checked the log i am still getting TransactionTooLargeException
Adding to the above, my writetodisk method is not executing as the bundle is null. Please suggest
Bundle bundle = new Bundle();
mSavedStateHandler.saveInstanceState(target, bundle);
if (bundle.isEmpty()) {
// Don't bother saving empty bundles
return;
}
The key idea here is that Bridge
is constructed in a way such that given an object, your SavedStateHandler
is responsible for adding data to the Bundle
. It simply does not support directly adding data to the Bundle
in the way you are suggesting. As suggested in #14 (comment) , using a new interface could allow you to manually add data, but still not quite in the way you are trying to do. You can refer to the sample app for correct usage.
Thanks for the quick response. It worked with custom StateManager interface. Thank you so much @byencho
No problem, @AparnaKS! Glad to help.