Answer the question
In order to leave comments, you need to log in
Android, why can't set a fragment from a variable?
Hello, I have a problem, my phone shows a black screen when I try to insert my class object into FragmentTransaction
LoginFragment lf = new LoginFragment();
fTrans = getFragmentManager().beginTransaction();
fTrans.add(R.id.loginContainer, lf).commit();
fTrans = getFragmentManager().beginTransaction();
fTrans.add(R.id.loginContainer,
new LoginFragment()).commit();
Answer the question
In order to leave comments, you need to log in
At first glance, everything should work. If specific to version 4.0.3, or device specific, make sure to use the support library classes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question