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


Java FragmentManager.popBackStack方法代码示例

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


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

示例1: goBack

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void goBack() {
    FragmentManager fragmentManager = getFragmentManager();
    if (mDisplayMode == DisplayMode.MESSAGE_VIEW) {
        showMessageList();
    } else if (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStack();
    } else if (mMessageListFragment.isManualSearch()) {
        finish();
    } else if (!mSingleFolderMode) {
        onAccounts();
    } else {
        onShowFolderList();
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:16,代码来源:MessageList.java

示例2: onBackPressed

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        // 백스택이 존재할 떄까지
        if (fm.getBackStackEntryCount() > 0)
        {
            fm.popBackStack();
            ft.commit();
        }
        // 백스택이 없는 경우
        else
        {
            super.onBackPressed();
        }
    }
}
 
开发者ID:JoMingyu,项目名称:Daejeon-People,代码行数:22,代码来源:Main.java

示例3: onBackPressed

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    FragmentManager fm = getFragmentManager();
    if (fm.getBackStackEntryCount() > 0) {
        fm.popBackStack();
    } else {
        new AlertDialog.Builder(this)
                .setTitle("Exit")
                .setMessage("Are you sure you want to exit?")
                .setNegativeButton(android.R.string.no, null)
                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                }).create().show();
    }
}
 
开发者ID:BranchMetrics,项目名称:Branch-Monster-Factory-Example-Android-Instant-Apps,代码行数:19,代码来源:MonsterViewerActivity.java

示例4: onOptionsItemSelected

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            FragmentManager fm = getFragmentManager();
            if (fm.getBackStackEntryCount() > 0) {
                fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
            } else {
                finish();
            }
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:BaseActivity.java

示例5: onBackPressed

import android.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    FragmentManager fm = getFragmentManager();

    if (fm.getBackStackEntryCount() > 0) {
        fm.popBackStack();
        mCurrentPath = FileUtils.cutLastSegmentOfPath(mCurrentPath);
        updateTitle();
    } else {
        setResult(RESULT_CANCELED);
        super.onBackPressed();
    }
}
 
开发者ID:qq1198,项目名称:mtoolbox,代码行数:14,代码来源:FilePickerActivity.java

示例6: returnFromFragment

import android.app.FragmentManager; //导入方法依赖的package包/类
public static void returnFromFragment(final Fragment fragment){
	final Activity activity=fragment.getActivity();
	if (activity!=null){
		final FragmentManager fragmentManager=activity.getFragmentManager();
		if (fragmentManager!=null) {
			fragmentManager.popBackStack();
		}
	}
}
 
开发者ID:videgro,项目名称:Ships,代码行数:10,代码来源:FragmentUtils.java

示例7: dismiss

import android.app.FragmentManager; //导入方法依赖的package包/类
public void dismiss() {
	FragmentManager fragmentManager = getFragmentManager();
	if (fragmentManager != null) {
		fragmentManager.beginTransaction().remove(BrowseErrorFragment.this).commit();
		fragmentManager.popBackStack();
	}
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:8,代码来源:BrowseErrorFragment.java

示例8: popBackStack

import android.app.FragmentManager; //导入方法依赖的package包/类
public static boolean popBackStack(FragmentManager fragmentManager)
{
	if(backStackKeys.size() > 0)
	{
		String popToKey = backStackKeys.get(backStackKeys.size() - 1);
		backStackKeys.remove(backStackKeys.size() - 1);
		fragmentManager.popBackStack(popToKey, FragmentManager.POP_BACK_STACK_INCLUSIVE);
		return true;
	}
	else
	{
		return false;
	}
}
 
开发者ID:WowWeeLabs,项目名称:CHIP-Android-SDK,代码行数:15,代码来源:FragmentHelper.java

示例9: popToRoot

import android.app.FragmentManager; //导入方法依赖的package包/类
public static void popToRoot(FragmentManager fragmentManager) {
	if(backStackKeys.size() > 0) {
		String popToKey = backStackKeys.get(0);
		backStackKeys.clear();
		fragmentManager.popBackStack(popToKey, FragmentManager.POP_BACK_STACK_INCLUSIVE);
	}
}
 
开发者ID:WowWeeLabs,项目名称:CHIP-Android-SDK,代码行数:8,代码来源:FragmentHelper.java


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