I am a beginner in android so I might be missing something simple but I have a "strange problem". I have two fragments and I can display them successfully when I want to display them on their own. Now I want to display them side by side and I wrote the following but it only displays the second fragment. (frag2)
Here is the xml in my activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<fragment class="com.example.frag1"
android:id="@+id/fragone"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<fragment class="com.example.frag2"
android:id="@+id/fragtwo"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Here is the activity I use
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout_activity_main);
}