I haven\'t found something like setTag(String tagName)
method in the Fragment
class. The only way to set a Fragment
tag that I have fo
You can add the tag as a property for the Fragment
arguments. It will be automatically restored if the fragment is destroyed and then recreated by the OS.
Example:-
final Bundle args = new Bundle();
args.putString("TAG", "my tag");
fragment.setArguments(args);
You can provide a tag inside your activity layout xml file.
Supply the android:tag attribute
with a unique string.
Just as you would assign an id in a layout xml.
android:tag="unique_tag"
link to developer guide