In the following code, the fragments are being dynamically inflated from a 
layout xml. The issue i am facing is that I dont see the fragments when i 
rotate the device.

If I look at the fragmentManager, I do see fragments are there. They are 
added and attached, but no where on the screen.

    MenuCard extends Activity {
    
        @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
            
            setContentView(R.layout.content);
    
    leftContainer = (FrameLayout) findViewById(R.id.leftContainer);
    rightContainer = (FrameLayout) findViewById(R.id.rightContainer);
            
            
            Fragment fragment = 
mFragmentManager.findFragmentById(R.id.leftFragment);
    if (fragment == null) {
    LayoutInflater.from(this).inflate(R.layout.left_fragment, 
leftContainer);
    }
    
    fragment = mFragmentManager.findFragmentById(R.id.rightFragment);
    if (fragment == null) {
    LayoutInflater.from(this).inflate(R.layout.right_fragment, 
rightContainer);
    }
    }
            }
        }
    
    }

R.layout.left_fragment

    <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android";
        xmlns:tools="http://schemas.android.com/tools";
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/leftFragment"
        android:name="com.example.LeftFragment"
        tools:layout="@layout/left_fragment">
    
    </fragment>

R.layout.right_fragment

    <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android";
        xmlns:tools="http://schemas.android.com/tools";
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/rightFragment"
        android:name="com.example.LeftFragment"
        tools:layout="@layout/left_fragment">
    
    </fragment>

Adding the code for R.layout.content

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.v4.widget.SlidingPaneLayout 
xmlns:android="http://schemas.android.com/apk/res/android";
    android:id="@+id/spl"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
    <FrameLayout
    android:id="@+id/leftContainer"
            android:layout_width="320dp"
    android:layout_height="match_parent"
    android:background="#00AFF0"
    />
    
    <FrameLayout
    android:id="@+id/rightContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />
    </android.support.v4.widget.SlidingPaneLayout>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to