The solution is :
In my abstract fragment class (extends from Fragment)
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
final View view = getView();
ViewTreeObserver observer = view.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
LayoutInflater inflater = (LayoutInflater) ARApplication.getAppContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
populateViewForOrientation(inflater, (ViewGroup) getView());
// Avoid infinite loop
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
protected abstract void populateViewForOrientation(LayoutInflater inflater, ViewGroup view);
Every instance of MyFragment have to implement the populateViewForOrientation() method :
protected void populateViewForOrientation(LayoutInflater inflater, ViewGroup viewGroup) {
viewGroup.removeAllViewsInLayout();
View subview = inflater.inflate(R.layout.welcome, viewGroup);
// do all the stuff
}