I am trying to use reflection in the following way (trying to store a class name inside a variable)
String ClassName="";
if(someConditoin)
ClassName="MyFragment";
else
ClassName="MyAnotherFragment";
fragmentManager.beginTransaction().setCustomAnimations(R.animator.translate_fragment_left_to_right, R.animator.translate_fragment_source_left_to_right)
.replace(R.id.container, new ClassName())
.commit();
Is anything like this possible? The fragment that is going to be used will be determined dynamically. There should be some support for this type of functionality.
Aucun commentaire:
Enregistrer un commentaire