use of android.support.v4.app.FragmentManager in project android_frameworks_base by ResurrectionRemix.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.d("MainActivity", "-------------------------------------------------------");
// If we are starting afresh, start at the app list.
final FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
fm.beginTransaction().add(android.R.id.content, new AppListFragment()).commit();
}
}
use of android.support.v4.app.FragmentManager in project AndroidTraining by mixi-inc.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager pager = (ViewPager) findViewById(R.id.Pager);
FragmentManager fm = getSupportFragmentManager();
SampleFragmentPagerAdapter sampleFragmentPagerAdapter = new SampleFragmentPagerAdapter(fm);
pager.setAdapter(sampleFragmentPagerAdapter);
}
use of android.support.v4.app.FragmentManager in project storymaker by StoryMaker.
the class SceneEditorActivity method addPublishFragement.
private void addPublishFragement() {
FragmentManager fm = getSupportFragmentManager();
int layout = R.layout.fragment_complete_story;
if (mPublishFragment == null) {
mPublishFragment = new PublishFragment();
Bundle args = new Bundle();
args.putInt("layout", layout);
mPublishFragment.setArguments(args);
fm.beginTransaction().add(R.id.container, mPublishFragment, layout + "").commit();
} else {
fm.beginTransaction().show(mPublishFragment).commit();
}
mLastTabFrag = mPublishFragment;
}
use of android.support.v4.app.FragmentManager in project Android-Skin-Loader by fengjundev.
the class MainActivity method initFragment.
private void initFragment() {
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
if (fragment == null) {
fragment = new ArticleListFragment();
fm.beginTransaction().add(R.id.fragment_container, fragment).commit();
}
}
use of android.support.v4.app.FragmentManager in project AndroidUtilCode by Blankj.
the class FragmentUtils method getFragmentsIsInStack.
/**
* 根据栈参数获取同级别fragment
*
* @param fragmentManager fragment管理器
* @param isInStack 是否是栈中的
* @return 栈中同级别fragment
*/
private static List<Fragment> getFragmentsIsInStack(@NonNull FragmentManager fragmentManager, boolean isInStack) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null || fragments.isEmpty())
return Collections.emptyList();
List<Fragment> result = new ArrayList<>();
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null) {
if (isInStack) {
if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) {
result.add(fragment);
}
} else {
result.add(fragment);
}
}
}
return result;
}
Aggregations