Example usage for android.app Fragment setArguments

List of usage examples for android.app Fragment setArguments

Introduction

In this page you can find the example usage for android.app Fragment setArguments.

Prototype

public void setArguments(Bundle args) 

Source Link

Document

Supply the construction arguments for this fragment.

Usage

From source file:com.ptr.foldingpanelayout.sample.FoldingPaneLayoutActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new AnimalFragment();
    Bundle args = new Bundle();
    args.putInt(AnimalFragment.ARG_ANIMAL_NUMBER, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mPaneList.setItemChecked(position, true);
    setTitle(mAnimalTitles[position]);//w w  w .j av  a  2  s  .c o m
    mPaneLayout.closePane();
}

From source file:com.zzolta.android.gfrecipes.activities.MainActivity.java

private Fragment setupFeedbackFragment(int position) {
    final Fragment fragment = new FeedbackFragment();
    final Bundle bundle = new Bundle();
    bundle.putInt(ApplicationConstants.ARG_SECTION_NUMBER, position);
    fragment.setArguments(bundle);
    return fragment;
}

From source file:com.arquitetaweb.ttinder.MainActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new PlanetFragment();
    Bundle args = new Bundle();
    args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mPlanetTitles[position]);/*from  ww w.j  av a  2  s.  c  o m*/
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:org.technovanza.technovanza14.MainActivity_Nav_SideBar.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new TabFragment();
    Bundle args = new Bundle();
    args.putInt(TabFragment.ARG_PLANET_NUMBER, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mPlanetTitles[position]);//  w  w  w  .  ja  v a2  s . co  m
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.kupepia.piandroidagent.ui.MainActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new ActivityDetailFragment();
    Bundle args = new Bundle();
    args.putInt(ActivityDetailFragment.FEATURE_ID, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(AppContent.ITEMS.get(position).toString());
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.veggies.android.todoList.MainActivity.java

private void selectItem(int position) {
    String[] drawer_array = getResources().getStringArray(R.array.drawer_array);

    if (position == mDrawerItems.get(this.getResources().getString(R.string.drawer_item_list))) {
        listFragmentFlag = true;//from w w w  . j  av  a 2  s  . c  o  m
        setActionMenu();
        Bundle data = new Bundle();
        data.putInt(TYPE, 5);
        //selected To-do list
        // update the main content by replacing fragments
        Fragment fragment = new ListViewFragment();
        fragment.setArguments(data);
        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment, TODOFRAG).commit();

    } else if (position == mDrawerItems.get(this.getResources().getString(R.string.drawer_item_setting))) {
        listFragmentFlag = false;
        hideActionMenu();
        //selected setting
        // update the main content by replacing fragments
        Fragment fragment = new SettingFragment();
        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
    }

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(drawer_array[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.example.android.reward.MainActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new EndTripFragment();
    Bundle args = new Bundle();
    args.putInt(EndTripFragment.ARG_PLANET_NUMBER, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction ft = fragmentManager.beginTransaction();
    //ft.replace(R.id.content_frame, fragment);
    ft.add(R.id.content_frame, fragment);

    ft.addToBackStack("null");
    ft.commit();/*from www  .  j  a v  a 2  s  . c  o m*/

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mPlanetTitles[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.manuelpeinado.fadingactionbar.demo.NavigationDrawerActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new SampleFragment();
    Bundle args = new Bundle();
    args.putInt(SampleFragment.ARG_IMAGE_RES, mCityImages[position]);
    args.putInt(SampleFragment.ARG_ACTION_BG_RES, R.drawable.ab_background);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mCityNames[position]);//from   w  w w. j a  va 2  s  .  c o m
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.prashantb.customized_navigation_drawer.MainActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new PlanetFragment();
    Bundle args = new Bundle();
    args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mPlanetTitles[position]);//from   w  w  w .j  av  a 2s. com
    mDrawerLayout.closeDrawer(mLinearLayout);
}

From source file:com.ptr.foldingdrawerlayout.sample.FoldingDrawerLayoutActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new AnimalFragment();
    Bundle args = new Bundle();
    args.putInt(AnimalFragment.ARG_ANIMAL_NUMBER, position);
    fragment.setArguments(args);

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mAnimalTitles[position]);/*from   w  w w. j av  a 2s . c  o m*/
    mDrawerLayout.closeDrawer(mDrawerList);
}