當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。