livefront / bridge

An Android library for avoiding TransactionTooLargeException during state saving and restoration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow data clearing to be deferred

byencho opened this issue · comments

Currently the Bridge.clear() method requires a reference to the target object in order to clear its data. Typically this method would be called in the onDestroy method of a particular Activity or Fragment that is about to be discarded. There are cases, however, where this may delete data that is still needed. For example, when using a FragmentStatePagerAdapter, each Fragment is "destroyed" when it is no longer actively being viewed but its saved state Bundle may be saved in order to reconstruct that Fragment again later. In these cases we should provide a way for a caller to manually specify a "clearing tag" to associate with the saved data. This tag could then be used later to actually clear the data. In the FragmentStatePagerAdapter example, the data could be cleared in the onDestroy of the parent Activity with a call like Bridge.clearForTag("tag").