本文整理匯總了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();
}
}
示例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();
}
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
}
示例7: dismiss
import android.app.FragmentManager; //導入方法依賴的package包/類
public void dismiss() {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
fragmentManager.beginTransaction().remove(BrowseErrorFragment.this).commit();
fragmentManager.popBackStack();
}
}
示例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;
}
}
示例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);
}
}