Code example for Fragment

Methods: getActivityonCreate

0
    public static final String TAG = TaskFragment.class.getName();
    protected TaskExecutor mTaskExecutor = null;
 
    @Override 
    public void onCreate(Bundle bundle) {
	super.onCreate(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."); 
	} 
    } 
} 
Experience pair programming with AI  Get Codota for Java