Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.3 KB

README.md

File metadata and controls

34 lines (26 loc) · 1.3 KB

Donate Hits

Persistent Helper

Easy way to persist any objects when Android screen rotation

Logo

By using this library you eliminate lot of code that is used for saving data when screen orientation changes

Use the following code to save and restore data:

public class ExampleFragment extends Fragment {
    @Persistent
    private Object javaObject;
    @Persistent
    private int currentPosition;

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        PersistentHelper.saveState(this, outState, Fragment.class);
        //javaObject and currentPosition saved
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        PersistentHelper.restoreState(this, savedInstanceState, Fragment.class);
        //javaObject and currentPosition restored
    }
For additional information mailto: [email protected]