Code example for Fragment

Methods: getActivity, onCreate, setHasOptionsMenu

0
     
    private int startTab;
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
        AnalyticsUtils.getInstance(getActivity()).trackPageView("/Map");
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
 
        mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_map_detail, null);
         
        final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
        Bundle extras = intent.getExtras();
		if (extras != null) {
			startTab = extras.getInt(EXTRA_ROOM);
		}