Search in sources :

Example 86 with FragmentManager

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();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager)

Example 87 with FragmentManager

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);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) ViewPager(android.support.v4.view.ViewPager)

Example 88 with FragmentManager

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;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Bundle(android.os.Bundle)

Example 89 with FragmentManager

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();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Fragment(android.support.v4.app.Fragment) ArticleListFragment(cn.feng.skin.demo.fragment.ArticleListFragment) ArticleListFragment(cn.feng.skin.demo.fragment.ArticleListFragment)

Example 90 with FragmentManager

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;
}
Also used : ArrayList(java.util.ArrayList) Fragment(android.support.v4.app.Fragment)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)293 FragmentTransaction (android.support.v4.app.FragmentTransaction)106 Fragment (android.support.v4.app.Fragment)99 View (android.view.View)53 TextView (android.widget.TextView)35 Bundle (android.os.Bundle)31 OnClickListener (android.view.View.OnClickListener)24 DialogFragment (android.support.v4.app.DialogFragment)23 Intent (android.content.Intent)20 ImageView (android.widget.ImageView)16 ScrollView (android.widget.ScrollView)14 ListFragment (android.support.v4.app.ListFragment)12 Button (android.widget.Button)11 ArrayList (java.util.ArrayList)9 FrontPageFragment (ingage.ingage20.fragments.FrontPageFragment)8 SearchResultFragment (ingage.ingage20.fragments.SearchResultFragment)8 ViewPager (android.support.v4.view.ViewPager)7 ActionBar (android.support.v7.app.ActionBar)7 RecyclerView (android.support.v7.widget.RecyclerView)7 CategoriesPageFragment (ingage.ingage20.fragments.CategoriesPageFragment)7