当前位置: 首页>>代码示例>>Java>>正文


Java FragmentTransaction.remove方法代码示例

本文整理汇总了Java中android.app.FragmentTransaction.remove方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentTransaction.remove方法的具体用法?Java FragmentTransaction.remove怎么用?Java FragmentTransaction.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.FragmentTransaction的用法示例。


在下文中一共展示了FragmentTransaction.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeFragment

import android.app.FragmentTransaction; //导入方法依赖的package包/类
public static void removeFragment(FragmentManager fragmentManager, int containViewId)
{
	if(fragmentManager != null) {
		Fragment fragment = fragmentManager.findFragmentById(containViewId);
		if (fragment != null)
		{
			fragments.remove(fragment);
			
			// TODO: Remove from backStackKeys
			
			FragmentTransaction transaction = fragmentManager.beginTransaction();
			transaction.remove(fragment);
			transaction.commitAllowingStateLoss();
		}
	}
	else {
		Log.e("FragmentHelper", "Fragment Manager = null");
	}
}
 
开发者ID:WowWeeLabs,项目名称:CHIP-Android-SDK,代码行数:20,代码来源:FragmentHelper.java

示例2: showDialog

import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void showDialog(Bundle bundle) {
    final Activity activity = (Activity) context;
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    Fragment prev = activity.getFragmentManager().findFragmentByTag("dialog2");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    ArrayList<String> list = (ArrayList<String>) bundle.get("adduid");
    MyDialogFragment newFragment = MyDialogFragment.newInstance(bundle);
    newFragment.setContext(context);
    newFragment.setListener(listener);
    newFragment.show(ft, "dialog2");

}
 
开发者ID:icaynia,项目名称:pracler,代码行数:17,代码来源:PlayListSelecter.java

示例3: removeMessageViewFragment

import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 * Remove MessageViewFragment if necessary.
 */
private void removeMessageViewFragment() {
    if (mMessageViewFragment != null) {
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.remove(mMessageViewFragment);
        mMessageViewFragment = null;
        ft.commit();

        showDefaultTitleView();
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:14,代码来源:MessageList.java

示例4: removeFragment

import android.app.FragmentTransaction; //导入方法依赖的package包/类
@SuppressWarnings("SameParameterValue")
private void removeFragment(final Fragment fragment, final boolean addToBackStack,
                            final boolean allowStateLoss) {
    final FragmentManager fm = getFragmentManager();

    final FragmentTransaction transaction = fm.beginTransaction();

    final String tag;

    if (fragment instanceof CurrentFeedFragment) {
        tag = CurrentFeedFragment.TAG;
    } else if (fragment instanceof FeedSubscriptionsFragment) {
        tag = FeedSubscriptionsFragment.TAG;
    } else if (fragment instanceof SavedEntriesFragment) {
        tag = SavedEntriesFragment.TAG;
    } else if (fragment instanceof InitialSetupFragment) {
        tag = InitialSetupFragment.TAG;
    } else {
        tag = LoadCurrentFeedFragment.TAG;
    }

    transaction.remove(fragment);

    if (addToBackStack) {
        transaction.addToBackStack(tag);
    }

    if (allowStateLoss) {
        transaction.commitAllowingStateLoss();
    } else {
        transaction.commit();
    }
    fm.executePendingTransactions();
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:35,代码来源:MainActivity.java

示例5: dismiss

import android.app.FragmentTransaction; //导入方法依赖的package包/类
public void dismiss() {
    if (mDismissed) {
        return;
    }
    mDismissed = true;
    getFragmentManager().popBackStack();
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.remove(this);
    ft.commit();
}
 
开发者ID:hh-in-zhuzhou,项目名称:ShangHanLun,代码行数:11,代码来源:ActionSheet.java

示例6: OnComplete

import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 * Destroys fragment and resets UI after the user either cancels or finishes sending a story.
 */
public void OnComplete() {
    FragmentManager manager = getFragmentManager();
    FragmentTransaction transaction = manager.beginTransaction();
    transaction.remove(manager.findFragmentByTag("AddStoryFragment_1"));
    transaction.commit();

    adapter.setcheck(false);
    supportInvalidateOptionsMenu();
    findViewById(R.id.go_to_map).setVisibility(View.VISIBLE);
    findViewById(R.id.fab).setVisibility(View.VISIBLE);
}
 
开发者ID:CMPUT301W17T08,项目名称:Moodr,代码行数:15,代码来源:MyProfileActivity.java

示例7: showUserFragment

import android.app.FragmentTransaction; //导入方法依赖的package包/类
private void showUserFragment(User user){
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag(USER_FRAGMENT_LABEL);
    if(prev != null){
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    UserFragment newFragment = UserFragment.newInstance(user);
    newFragment.show(ft, USER_FRAGMENT_LABEL);
}
 
开发者ID:Bartout-Team,项目名称:Bartout,代码行数:11,代码来源:BartourActivity.java

示例8: clearAllBackStackFragments

import android.app.FragmentTransaction; //导入方法依赖的package包/类
public static void clearAllBackStackFragments(FragmentManager fragmentManager)
{
	FragmentTransaction ft = fragmentManager.beginTransaction();

    for (WeakReference<Fragment> ref : fragments) {
        Fragment fragment = ref.get();
        if (fragment != null) {
            ft.remove(fragment);
        }
    }
    fragments.clear();
    backStackKeys.clear();

    ft.commitAllowingStateLoss();
}
 
开发者ID:WowWeeLabs,项目名称:CHIP-Android-SDK,代码行数:16,代码来源:FragmentHelper.java

示例9: setupTransaction

import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 * Setup a base dialog fragment transaction. Handles the removing of a
 * previous fragment if it exists and adds itself to the backstack.
 *
 * @return FragmentTransaction
 */
private FragmentTransaction setupTransaction(Activity activity) {
    FragmentManager manager = activity.getFragmentManager();
    FragmentTransaction ft = manager.beginTransaction();
    Fragment prev = manager.findFragmentByTag("dialog");

    if (prev != null)
        ft.remove(prev);

    ft.addToBackStack(null);

    return ft;
}
 
开发者ID:linklux,项目名称:android-schedules,代码行数:19,代码来源:BaseDialogFragment.java

示例10: removeAll

import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**清空所有fragment*/
public void removeAll(){
    FragmentTransaction ft = fm.beginTransaction();
    for (Fragment f:fs) {
        ft.remove(f);
    }
    ft.commitAllowingStateLoss();
}
 
开发者ID:WeGdufe,项目名称:MovingGdufe-Android,代码行数:9,代码来源:FragmentUtil.java

示例11: clearFragment

import android.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 * Metodo statico per eliminare il fragment, quando non sono disponibili parcheggi
 */
public static void clearFragment(MainActivity activity) {
    if(activity.getFragmentAttivo() != null) {
        // inizializza la fragmentTransaction per l'eliminazione
        ParcheggiFragment fragAttivo = activity.getFragmentAttivo();
        FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
        ft.remove(fragAttivo);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        ft.commit();

        // elimina il riferimento al fragment in MainActivity
        activity.setFragmentAttivo(null);
    }
}
 
开发者ID:IelloDevTeam,项目名称:IelloAndroidApp,代码行数:17,代码来源:ParcheggiFragment.java

示例12: closeFragment

import android.app.FragmentTransaction; //导入方法依赖的package包/类
private void closeFragment() {
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.remove(fragment);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commit();
    addParticipantContainer.setVisibility(View.GONE);
    isFragmentOpen = false;
}
 
开发者ID:StringflowServer,项目名称:Beach-Android,代码行数:10,代码来源:GroupDetailsActivity.java

示例13: showEula

import android.app.FragmentTransaction; //导入方法依赖的package包/类
public static void showEula(Activity activity) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_eula");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    new EulaDialog().show(ft, "dialog_eula");
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:12,代码来源:AboutUtils.java

示例14: showDialog

import android.app.FragmentTransaction; //导入方法依赖的package包/类
private static void showDialog(Activity activity, Class clazz, String tag) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(tag);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    try {
        ((DialogFragment) clazz.newInstance()).show(ft, tag);
    } catch (InstantiationException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:16,代码来源:DialogHelper.java

示例15: showChangeLogDialog

import android.app.FragmentTransaction; //导入方法依赖的package包/类
public static void showChangeLogDialog(FragmentManager fragmentManager) {
    ChangelogDialog changelogDialog = new ChangelogDialog();
    FragmentTransaction ft = fragmentManager.beginTransaction();
    Fragment prev = fragmentManager.findFragmentByTag("changelogdemo_dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    changelogDialog.show(ft, "changelogdemo_dialog");
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:11,代码来源:ChangelogDialog.java


注:本文中的android.app.FragmentTransaction.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。