Skip to content

Pass information between activities and fragments at runtime, without needing to bundle information.

Notifications You must be signed in to change notification settings

clackbib/BundleJam

Repository files navigation

BundleJam

Bundle Jam is an annotation processor for android that allows you to save data from a fragment/activity at and pass it to another fragment/activity at runtime. For now, BundleJam operates using shared preferences.

Add this to your base fragments:

    @Override
    public void onPause() {
        super.onPause();
        JamProcessor.jamVariables(this);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        JamProcessor.unjamVariables(this);
    }

And use the following way:

  • To "Jam" information in Shared Preferences at runtime:
    @Jam(key = FragmentC.FRAG_C_KEY)
    public String name;
    
    //Modifiy the value of name in your fragment
    name = "Habib";
  • And to "UnJam":
    public static final String FRAG_C_KEY = "FragCKey";

    @UnJam(key = FRAG_C_KEY)
    private String value;
    
    //Retrieve your saved data
    tvName.setText(name);

About

Pass information between activities and fragments at runtime, without needing to bundle information.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published