use only 1 activity, but with different FragmentTransactions for each of them. Use a LinearLayout as the root of your activity, let's call it R.id.content
and create a new XML values as follows in:
/values/device.xml
<item type="bool" format="boolean" name="isPhone">true</item>
/values-sw600dp/device.xml
<item type="bool" format="boolean" name="isPhone">false</item>
then your transactions will be like:
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Frag_C f = new Frag_C();
if(getResources().getBoolean(R.bool.isPhone)){ // phone
ft.replace(R.id.content, f, Frag_C.TAG);
}else { // tablet
Fragment left = getSupportFragmentManager().findFragmentByTag(Frag_A.TAG);
Fragment right = f;
ft.hide(left);
ft.add(R.id.content, right, FRAG_C.TAG);
}
ft.addToBackStack(null).commit();
and as a final note, when inflating each fragment, you MUST set the layout parameters WEIGHT
of the LinearLayout to control the width of the fragments. Something like that:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(layoutId(), container, false);
((LinearLayout.LayoutParams) v.getLayoutParams()).weight = 1;
}
so fragA weight would be 1, then B=2, then C=4, then D=8 (for example). So the left fragment will be 33% width n the right will be 66%. Vary the values however you need.
If you want to know how to animate those transactions, please refer to this answer I gave before https://stackoverflow.com/a/14155204/906362