Code example for Fragment

Methods: getActivityonCreate

    public static final String TAG = TaskFragment.class.getName();
    protected TaskExecutor mTaskExecutor = null;
    public void onCreate(Bundle bundle) {
	Activity activity = getActivity();
	if (activity instanceof TaskActivity) {
	    mTaskExecutor = ((TaskActivity) getActivity()).mTaskExecutor;
	} else { 
	    throw new CalledFromWrongActivityException("The calling Activity must be an instance of TaskActivity."); 
Stop searching for code, let great code find you!  Add Codota to your java IDE