本文整理了Java中android.app.FragmentManager.popBackStack()
方法的一些代码示例,展示了FragmentManager.popBackStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentManager.popBackStack()
方法的具体详情如下:
包路径:android.app.FragmentManager
类名称:FragmentManager
方法名:popBackStack
暂无
代码示例来源:origin: facebook/facebook-android-sdk
@Override
protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken,
AccessToken currentAccessToken) {
if (isResumed) {
FragmentManager manager = getFragmentManager();
int backStackSize = manager.getBackStackEntryCount();
for (int i = 0; i < backStackSize; i++) {
manager.popBackStack();
}
if (currentAccessToken != null) {
showFragment(SELECTION, false);
} else {
showFragment(SPLASH, false);
}
}
}
};
代码示例来源:origin: hitherejoe/animate
@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);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private void showLorem() {
if (lorem == null) {
lorem=new LoremFragment();
}
if (!lorem.isVisible()) {
getFragmentManager().popBackStack();
getFragmentManager().beginTransaction()
.replace(R.id.content, lorem).commit();
drawer.post(onNavChange);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
private void showContent() {
if (content == null) {
content=new ContentFragment();
}
if (!content.isVisible()) {
getFragmentManager().popBackStack();
getFragmentManager().beginTransaction()
.replace(R.id.content, content).commit();
drawer.post(onNavChange);
}
}
代码示例来源:origin: hitherejoe/animate
@Override
public void onBackPressed() {
if (mFragment != null) {
FragmentManager manager = getFragmentManager();
FragmentTransaction trans = manager.beginTransaction();
trans.remove(mFragment);
trans.commit();
manager.popBackStack();
mFragment = null;
mRevealButton.animate()
.scaleX(1f)
.scaleY(1f)
.setListener(null)
.start();
} else {
super.onBackPressed();
}
}
代码示例来源:origin: ac-pm/Inspeckage
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
int count = getFragmentManager().getBackStackEntryCount();
if (count == 1) {
stopService();
super.onBackPressed();
//additional code
} else {
getFragmentManager().popBackStack();
}
}
代码示例来源:origin: com.albedinsky.android/fragments
/**
* Delegate method for {@link android.app.FragmentManager#popBackStack()}.
*/
public void hideVisibleFragment() {
mFragmentManager.popBackStack();
}
代码示例来源:origin: OceanLabs/Android-Print-SDK
/*****************************************************
*
* Removes a fragment.
*
*****************************************************/
protected void popFragment()
{
mFragmentManager.popBackStack();
}
代码示例来源:origin: CodingBingo/FastReader
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.back_btn:
getFragmentManager().popBackStack();
break;
}
}
代码示例来源:origin: AndreiD/UltimateAndroidTemplateRx
@Override public void onBackPressed() {
if (getFragmentManager().getBackStackEntryCount() > 0) {
getFragmentManager().popBackStack();
} else {
super.onBackPressed();
}
}
}
代码示例来源:origin: Rachel-Ding/Android-Tiny-Projects
@Override
public void onBackPressed() {
if (getFragmentManager().getBackStackEntryCount() > 0) {
getFragmentManager().popBackStack();
} else {
super.onBackPressed();
}
}
}
代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android
@Override
public void onBackPressed(){
FragmentManager fm = getFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
} else {
super.onBackPressed();
}
}
代码示例来源:origin: box/box-android-sdk
@Override
public void onDifferentAuthenticationChosen() {
Fragment fragment = getFragmentManager().findFragmentByTag(CHOOSE_AUTH_TAG);
if (fragment != null){
getFragmentManager().popBackStack();
}
}
代码示例来源:origin: PDF417/pdf417-android
@WorkerThread
private void removeFragment() {
getFragmentManager().popBackStack();
mRecognizerRunnerFragment = null;
runOnUiThread(new Runnable() {
@Override
public void run() {
View scanLayout = findViewById(R.id.recognizer_runner_view_container);
scanLayout.setVisibility(View.GONE);
}
});
}
代码示例来源:origin: indywidualny/FaceSlim
@Override
public void onBackPressed() {
int count = getFragmentManager().getBackStackEntryCount();
if (count == 0) {
startActivity(new Intent(this, MainActivity.class));
finish();
//super.onBackPressed();
} else
getFragmentManager().popBackStack();
}
代码示例来源:origin: bxbxbai/ZhuanLan
@Override
public void onBackPressed() {
closeDrawer();
// Otherwise, it may return to the previous fragment stack
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack();
} else {
// Lastly, it will rely on the system behavior for back
super.onBackPressed();
}
}
代码示例来源:origin: youtube/yt-direct-lite-android
public boolean popPlayerFromBackStack() {
if (mIsFullScreen) {
mYouTubePlayer.setFullscreen(false);
return false;
}
if (getFragmentManager().findFragmentByTag(YOUTUBE_FRAGMENT_TAG) != null) {
getFragmentManager().popBackStack();
return false;
}
return true;
}
代码示例来源:origin: geniusgithub/AndroidDialer
@Override
public void onBackPressed() {
if (getFragmentManager().getBackStackEntryCount() > 0) {
setActivityTitle(R.string.activity_title_settings);
getFragmentManager().popBackStack();
} else {
super.onBackPressed();
}
}
代码示例来源:origin: CodingBingo/FastReader
@Override
public void onChapterClick(int chapter) {
mCurrentChapter = chapter;
Book book = getDaoSession().getBookDao().load(bookId);
book.setCurrentChapter(chapter);
book.setCurrentPosition(mChapterList.get(chapter).getPosition());
getDaoSession().getBookDao().update(book);
EventBus.getDefault().post(new BookStatusChangeEvent(Constants.BOOK_PROCESSED, 100, bookId));
getFragmentManager().popBackStack();
}
}
代码示例来源:origin: vbier/habpanelviewer
@Override
public void onBackPressed() {
// this if statement is necessary to navigate through nested and main fragments
if (getFragmentManager().getBackStackEntryCount() == 0) {
super.onBackPressed();
} else {
mUpItem.setEnabled(getFragmentManager().getBackStackEntryCount() > 1);
UiUtil.tintItemPreV21(mUpItem, getApplicationContext(), getTheme());
getFragmentManager().popBackStack();
}
}
内容来源于网络,如有侵权,请联系作者删除!