package org.ntlab.radishforandroidstudio.cactusClient.views; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import org.ntlab.radishforandroidstudio.R; public class BaseFragment extends Fragment { public BaseFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_base, container, false); return view; } protected void replaceFragment(int containerViewId, Fragment fragment, boolean flag) { if (flag) { getFragmentManager().beginTransaction().replace(containerViewId, fragment).addToBackStack(null).commit(); } else { getFragmentManager().beginTransaction().replace(containerViewId, fragment).commit(); } } }