Code example for FragmentTransaction

Methods: commit, replace

0
        FragmentManager fm = getSupportFragmentManager();
         
        Fragment f = fm.findFragmentById(android.R.id.content);
        if (f == null) {
            FragmentTransaction ft = fm.beginTransaction();
            ft.replace(android.R.id.content, Fragment.instantiate(this, UpdateStatusFragment.class.getName()), sPostFragmentTag);
            ft.commit();
		} 
    } 
     
    private UpdateStatusFragment getPostFragment() { 
    	return (UpdateStatusFragment) getSupportFragmentManager().findFragmentByTag(sPostFragmentTag);
    } 
 
    private ImagePickerFragment getImagePickerFragment() { 
    	return (ImagePickerFragment) getSupportFragmentManager().findFragmentByTag(UpdateStatusFragment.TAG_PICKER); 
    } 
 
	@Override 
	public void onImagePicked(String path) {
		UpdateStatusFragment postFragment = getPostFragment();