A large class was developed, now you need to cram it into this code:

package info.androidhive.slidingmenu; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class HomeFragment extends Fragment { public HomeFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_home, container, false); return rootView; } } 
  • And what exactly confuses you? They work with the fragment in the same way as with the Activity, the only thing is that it has its own interface (xml), which we access via inflater. For example, to get the button object in the fragment - Button button1 = (Button) rootView.findViewById (R.id.button1). If you need to get the context or Activity to which the fragment is located - getActivity (). The question is not clear). - Nuclominus
  • Thanks, some elements do not work, for example this.getWindow (). RequestFeature (Window.FEATURE_PROGRESS); SharedPreferences settings = getSharedPreferences (PREFS_NAME, 0); public boolean onKeyDown (int keyCode, KeyEvent event) {SharedPreferences settings = getSharedPreferences (PREFS_NAME, 0); - Rammsteinik
  • Thanks, with getActivity () helped a lot. First day on the fragments. It remains only to understand how to adjust the string to the fragment final Activity Activity activity = this; - Rammsteinik

0