Code example for Fragment

Methods: getActivity, onCreateView

0
	} 
	 
	@Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if(DEBUG) Log.d(TAG, ".onCreateView()...");
		super.onCreateView(inflater, container, savedInstanceState);
		if(DEBUG) Log.d(TAG, "...this fragment's Activity: "+this.getActivity().getClass().getSimpleName());
		//note that we only setup a containing LinearLayout here and populate it in onActivityCreated() 
		mContainer = new LinearLayout(getActivity());
		return mContainer;
    } 
	 
	@Override 
	public void onActivityCreated(Bundle savedInstanceState) {
		if(DEBUG) Log.d(TAG, ".onActivityCreated()...");
        super.onActivityCreated(savedInstanceState);
		mFragmentBaseView = mWindow.getDecorView();
		mFragmentBaseView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
		mFragmentBaseView.setVisibility(View.VISIBLE);
		mFragmentBaseView.setFocusableInTouchMode(true);
		((ViewGroup)mFragmentBaseView).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);