Buenas, estoy desarrollando una App, que al ejecutarla aparece un LaunchScreen donde obtengo con AsynTask datos para mostrarlo en la primera pantalla.
Hasta ahí todo bien. El problema es el siguiente: tengo un DrawerLayout en el layout de la actividad Inicio como éste:
<LinearLayout 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"
tools:context=".MyActivity"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:theme="@style/ToolbarTheme"
app:popupTheme="@style/Theme.AppCompat"/>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/content_inicio" />
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="@android:id/list"
android:background="@android:color/white"
android:layout_width="305dp"
android:layout_height="match_parent"
android:layout_gravity="start"/>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Ahí estoy incluyendo otro layout, donde muestro información, la cuál he pasado a través del 'LaunchScreen', pero quiero que todas las ventanas sean Fragments, para que cuando selecciones un elemento de la lista del DrawerLayout, me vaya cambiando entre mis diferentes Fragments. Así que estoy teniendo problemas con esto, ya que cargo información de la BD externa y según el elemento del DrawerLayout hace consultas a diferentes URLs.
Tengo 2 Fragments para probarlo y cuando hace click en otro elemento del DrawerLayout, lo que hace es ponerme el nuevo Fragment encima del otro.
Así son los Fragments:
@SuppressLint("NewApi")
public class FragmentInicio extends Fragment {
View rootView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.content_inicio, container, false);
return rootView;
}
}
Espero que me entendáis lo que quiero hacer.



