Skip to content

Easy way to persist any objects when Android screen rotation

Notifications You must be signed in to change notification settings

Duna/PersistentHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: dunatv@gmail.com

About

Easy way to persist any objects when Android screen rotation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages