HTC phone uses different theme while creating fragment the first time and after orientation change

78 views Asked by At

I instantiate Fragment in the activity in a following manner:

Fragment fragment = new SimpleTestFragment();
fragment.setArguments(bundle);
final FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment, tag).addToBackStack(null).commit();

And now created fragment has no style applied to it, by what I mean textviews have white text etc. However after rotation the style gets applied properly.

One solution would be to use new, wrapped context in the onCreateView, however doing so in 10+ fragments seems unnecessary and just simply annoying.

And here is my question: Do you know of any other way to resolve this problem?

1

There are 1 answers

0
MatBos On BEST ANSWER

Solution

Make sure that you apply theme in the manifest to each of the declared activities, not only for the application.