I start new activity in android studio auto generated MainActivity.java file, which has Navigation drawer.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
startActivity(new Intent(getActivity(), Dishes.class));
This is my Dishes.java code
public class Dishes extends FragmentActivity {
//private Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//context = Dishes.this;
//fragment main s shown, but no original navigation drawer??
setContentView(R.layout.fragment_main);
new getData().execute("..");
}
ActivityMain.xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.app.MainActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="com.app.NavigationDrawerFragment" />
</android.support.v4.widget.DrawerLayout>
The problem is, that after i start new activity, the new layout is created and shown (i assume) and i cannot access old navigation drawer. How to fix it?