I would like to ask about the 
com.example.android.apis.app.FragmentRetainInstance.java in android api 
demo 4.0.3, which demos how to use fragment to handle configuration changes 
such as rotation.
At line 44-47
        if (savedInstanceState == null) {
            
getFragmentManager().beginTransaction().add(android.R.id.content,
                    new UiFragment()).commit();
        }
 
Why does it use android.R.id.content as the first argument at line 45?
 
The xml contains R.id.content is auto_complete_list.xml and the following 
is the content:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"; 
    android:id="@+id/content"
    android:orientation="vertical"
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:background="@android:drawable/edit_text"
    android:divider="@android:drawable/divider_horizontal_textfield"
    android:addStatesFromChildren="true">
    <LinearLayout android:id="@+id/container"
        android:orientation="vertical"
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"
        android:paddingRight="0dip"
    />
    <AutoCompleteTextView android:id="@+id/edit"
        android:completionThreshold="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:layout_gravity="center_vertical"
    />   
</LinearLayout>
There are two child under the root (R.id.content). 
However, when the code runs, I do not see the AutoCompleteTextView but only 
the layout inflate by UiFragment (R.layout.fragment_retain_instance).
Why? 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

<<attachment: screen.png>>

Reply via email to