本文整理了Java中android.app.FragmentManager.addOnBackStackChangedListener()
方法的一些代码示例,展示了FragmentManager.addOnBackStackChangedListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentManager.addOnBackStackChangedListener()
方法的具体详情如下:
包路径:android.app.FragmentManager
类名称:FragmentManager
方法名:addOnBackStackChangedListener
暂无
代码示例来源:origin: commonsguy/cw-omnibus
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
drawer=(ListView)findViewById(R.id.drawer);
drawer.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
String[] rows=getResources().getStringArray(R.array.drawer_rows);
drawer.setAdapter(new ArrayAdapter<String>(this,
R.layout.drawer_row,
rows));
drawer.setOnItemClickListener(this);
drawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
toggle=
new ActionBarDrawerToggle(this, drawerLayout,
R.drawable.ic_drawer,
R.string.drawer_open,
R.string.drawer_close);
drawerLayout.setDrawerListener(toggle);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
getFragmentManager().addOnBackStackChangedListener(this);
if (getFragmentManager().findFragmentById(R.id.content) == null) {
showLorem();
}
}
代码示例来源:origin: stackoverflow.com
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentManager fm = getFragmentManager();
fm.addOnBackStackChangedListener(new OnBackStackChangedListener() {
@Override
public void onBackStackChanged() {
if(getFragmentManager().getBackStackEntryCount() == 0) finish();
}
});
}
代码示例来源:origin: stackoverflow.com
FragmentManager fm = getFragmentManager();
fm.addOnBackStackChangedListener(new OnBackStackChangedListener() {
@Override
public void onBackStackChanged() {
}
});
代码示例来源:origin: OceanLabs/Android-Print-SDK
/*****************************************************
*
* Removes a fragment without triggering the back stack
* listener.
*
*****************************************************/
protected void popFragmentSecretly()
{
mFragmentManager.removeOnBackStackChangedListener( this );
mFragmentManager.popBackStackImmediate( ImageSourceFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE );
// Restore the back stack listener
mFragmentManager.addOnBackStackChangedListener( this );
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (null == savedInstanceState) {
String serviceId = getIntent().getStringExtra(EXTRA_SERVICE_ID);
startApp(currentPage, serviceId);
setTitleForPage(currentPage);
getFragmentManager().addOnBackStackChangedListener(this);
}
}
代码示例来源:origin: com.albedinsky.android/fragments
/**
* Creates a new instance of FragmentController with the given <var>fragmentManager</var>.
*
* @param fragmentManager Fragment manager that will be used to manage fragments.
* @see #FragmentController(android.app.Activity)
* @see #FragmentController(android.app.Fragment)
*/
public FragmentController(@NonNull FragmentManager fragmentManager) {
this.mFragmentManager = fragmentManager;
mFragmentManager.addOnBackStackChangedListener(new BackStackListener());
// Check for back stacked fragments.
final int n = mFragmentManager.getBackStackEntryCount();
if (n > 0) {
this.mTopBackStackEntry = mFragmentManager.getBackStackEntryAt(n - 1);
}
}
代码示例来源:origin: derry/delion
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The Chrome browser process must be started here because this Activity
// may be started explicitly from Android notifications.
// During a normal user flow the ChromeTabbedActivity would start the Chrome browser
// process and this wouldn't be necessary.
try {
ChromeBrowserInitializer.getInstance(this).handleSynchronousStartup();
} catch (ProcessInitException e) {
Log.e(TAG, "Failed to start browser process.", e);
ChromeApplication.reportStartupErrorAndExit(e);
return;
}
assert ProfileSyncService.get() != null;
getFragmentManager().addOnBackStackChangedListener(this);
}
代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android
private void showSettings(View v){
// Display the prefs fragment
WOWZLog.debug("*** getOriginalFrameSizes showSettings1");
prefsFragment.setActiveCamera(mWZCameraView != null ? mWZCameraView.getCamera() : null);
WOWZLog.debug("*** getOriginalFrameSizes showSettings2");
getFragmentManager().addOnBackStackChangedListener(backStackListener);
getFragmentManager().beginTransaction()
.replace(android.R.id.content, prefsFragment)
.addToBackStack(null)
.show(prefsFragment)
.commit();
WOWZLog.debug("*** getOriginalFrameSizes showSettings3");
}
代码示例来源:origin: dogriffiths/HeadFirstAndroid
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
getFragmentManager().addOnBackStackChangedListener(
new FragmentManager.OnBackStackChangedListener() {
public void onBackStackChanged() {
代码示例来源:origin: OceanLabs/Android-Print-SDK
/*****************************************************
*
* Called when the activity is created.
*
*****************************************************/
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
mKiteSDK = KiteSDK.getInstance( this );
mSDKCustomiser = mKiteSDK.getCustomiser();
// TODO: Check that we can now delete this line
CatalogueLoader.getInstance( this );
// Check if the inactivity timer is enabled
mInactivityTimerEnabled = mSDKCustomiser.inactivityTimerEnabled();
setInactivityTimerEnabledForThisActivity( mInactivityTimerEnabled );
// Listen for changes to the fragment back stack
mFragmentManager = getFragmentManager();
mFragmentManager.addOnBackStackChangedListener( this );
// See if we are displaying the log out dialog fragment
mInactivityLogOutDialogFragment = (LogOutDialogFragment)mFragmentManager.findFragmentByTag( LogOutDialogFragment.TAG );
setConfirmEndSessionAction( true );
}
内容来源于网络,如有侵权,请联系作者删除!