Skip to content

Custom fragment tag

JingYeoh edited this page Jan 26, 2018 · 4 revisions

Rigger will create a unique tag for fragment when the Fragment constructor is called.But the rule is UUID+Class simple name,so it's random.

This library support custom fragment tag.(Support version 1.1.0+)

Type One:(Support Version 1.1.0)

Use below code to custom fragment tag,but you need use this method before add fragment to FragmentTransaction.

Fragment fragment = Fragment.newInstance();
Rigger.getRigger(fragment).setFragmentTag("Custom tag");

Type Two:(Support Version 1.1.1)

Add below code in your fragment

public String getFragmentTag(){
   return "Custom Tag";
}

Note: Type one priority over Type two.