Code example for Fragment

Methods: getActivitygetArgumentsonCreate

1
	 
	@SuppressWarnings("deprecation") 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		if(DEBUG) Log.d(TAG, ".onCreate()...");
		super.onCreate(savedInstanceState);
		 
		Bundle state = null;
        if (savedInstanceState != null) {
            state = savedInstanceState.getBundle(KEY_STATE_BUNDLE);
        } 
		mLocalActivityManager = new LocalActivityManager(getActivity(), true);
		mLocalActivityManager.dispatchCreate(state);
		//pass the mapActivityStartupBundle along to the MapActivity 
		Intent mapActivityIntent = new Intent(getActivity(), TandemActivitiesMapActivity.class);
		Bundle mapActivityStartupBundle = this.getArguments();
		mapActivityIntent.putExtras(mapActivityStartupBundle);
		mWindow = mLocalActivityManager.startActivity("mapActivity", mapActivityIntent);
		 
		//ensure this FragmentActivity takes key events, rather than the MapActivity 
		//getActivity().takeKeyEvents(true);	//note: doesn't work when MapActivity is in foreground 
		((TandemActivitiesActivityInterface)mLocalActivityManager.getActivity("mapActivity")).setContainingFragmentActivity(getActivity());
		//TODo try using .requestFocus(View.FOCUS_FORWARD); and return mTabContent.dispatchKeyEvent(event); instead of ^ perhaps?? 
	} 
	 
	@Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Experience pair programming with AI  Get Codota for Java