Change Activity theme deppending on fragment in use Android
I have an activity that switches between several fragments. This activity has a default style, but when i change to some particular fragments i want it to change the style. I've done some research and i got this code that i run in the onCreateView() of a fragment: // create ContextThemeWrapper from the original Activity Context with the custom theme Context context = new ContextThemeWrapper(getActivity(), R.style.GreyTheme); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.cloneInContext(context); // inflate using the cloned inflater, not the passed