当前位置: 首页>>代码示例>>Java>>正文


Java Fragment.setArguments方法代码示例

本文整理汇总了Java中android.app.Fragment.setArguments方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.setArguments方法的具体用法?Java Fragment.setArguments怎么用?Java Fragment.setArguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Fragment的用法示例。


在下文中一共展示了Fragment.setArguments方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectItem

import android.app.Fragment; //导入方法依赖的package包/类
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
    mLeftDrawer.setItemChecked(position, true);
    setTitle(mContent[position]);
    mDlMain.closeDrawer(mLeftDrawer);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:Main2slideMenu.java

示例2: changeFragment

import android.app.Fragment; //导入方法依赖的package包/类
public void changeFragment(String tag) {
    mBackPressListener = null;
    Fragment fragment = null;

    if (FRAGMENT_GRID.equals(tag)) {
        fragment = new VideoGridFragment();
        fragment.setArguments(getIntent().getExtras());
        mBackPressListener = (VideoGridFragment) fragment;
    }

    if (fragment != null) {
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.replace(R.id.container, fragment, tag);
        transaction.commit();
    }
}
 
开发者ID:ficklerobot,项目名称:grid-video-viewer,代码行数:17,代码来源:GalleryActivity.java

示例3: prepare

import android.app.Fragment; //导入方法依赖的package包/类
public void prepare(Fragment toFragment) {
    final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
    if (Build.VERSION.SDK_INT >= 21) {
        toFragment.setSharedElementEnterTransition(new ChangeBounds());
        toFragment.setSharedElementReturnTransition(new ChangeBounds());
    }
    toFragment.setArguments(transitionBundle);
}
 
开发者ID:MSay2,项目名称:Mire,代码行数:9,代码来源:FragmentTransitionLauncher.java

示例4: newInstance

import android.app.Fragment; //导入方法依赖的package包/类
public static Fragment newInstance(String text) {
    Fragment fragment = new SampleFragmentV11();
    Bundle bundle = new Bundle();
    bundle.putString(KEY_TEXT, text);
    fragment.setArguments(bundle);
    return fragment;
}
 
开发者ID:aesean,项目名称:Rotate3d,代码行数:8,代码来源:SampleFragmentV11.java

示例5: openScreen

import android.app.Fragment; //导入方法依赖的package包/类
@Override public void openScreen(Module module, Screen screen, boolean clear) {

        if (clear) popBackStack();

        Fragment fragment = buildFragment(screen.getFragmentClass());
        fragment.setArguments(screen.getData());

        FragmentTransaction transaction = fragmentManager.get().beginTransaction();
        transaction.replace(module.provideContainer(), fragment);
        transaction.addToBackStack(screen.getFragmentClass().getSimpleName());

        if (activity instanceof TransactionManagerDefault)
            ((TransactionManagerDefault) activity).manage(transaction);

        transaction.commit();
    }
 
开发者ID:rostdev,项目名称:lepka,代码行数:17,代码来源:ExecutorDefault.java

示例6: setFragmentArgs

import android.app.Fragment; //导入方法依赖的package包/类
private void setFragmentArgs(Fragment frag) {
    Bundle bundle = new Bundle();
    String key = MobileClient.EXTRA_USER;
    MobileClient value = getIntent().getParcelableExtra(MobileClient.EXTRA_USER);
    bundle.putParcelable(key, value);
    frag.setArguments(bundle);
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:8,代码来源:PublisherActivity.java

示例7: navigate

import android.app.Fragment; //导入方法依赖的package包/类
private void navigate(final int itemId) {
    switch (itemId) {
        case R.id.menuSubItem1:
            Fragment contactsFrag = new ContactsFragment();
            Bundle bundle = new Bundle();
            String key = MobileClient.EXTRA_USER;
            MobileClient value = getIntent().getParcelableExtra(MobileClient.EXTRA_USER);
            bundle.putParcelable(key, value);
            contactsFrag.setArguments(bundle);
            getFragmentManager()
                    .beginTransaction()
                    .remove(contactsFrag)
                    .replace(R.id.subContentFrame, contactsFrag)
                    .commit();
            break;
        case R.id.menuSubItem2:
            getFragmentManager()
                    .beginTransaction()
                    .replace(R.id.subContentFrame, requestSubsFrag)
                    .commit();
            break;
        case R.id.menuSubItem3:
            SessionManager manager = new SessionManager(this);
            manager.logoutUser();
            break;
        default:
            break;
    }
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:30,代码来源:SubscriberActivity.java

示例8: setView

import android.app.Fragment; //导入方法依赖的package包/类
/**
 * Set the view to a certain fragment. Changes the subtitle as well.
 *
 * @param i    The view type constant
 * @param args The parameters for the fragment
 */
private void setView(int i, Bundle args) {
    final Fragment frg;
    switch (i) {
        default:
        case VIEW_TYPE_LIVEBOARD:
            frg = LiveboardSearchFragment.newInstance();
            setSubTitle(R.string.title_liveboard);
            break;
        case VIEW_TYPE_ROUTE:
            frg = RouteSearchFragment.newInstance();
            setSubTitle(R.string.title_route);
            break;
        case VIEW_TYPE_TRAIN:
            frg = TrainSearchFragment.newInstance();
            setSubTitle(R.string.title_train);
            break;
        case VIEW_TYPE_DISTURBANCE:
            frg = DisturbanceListFragment.newInstance();
            setSubTitle(R.string.title_disturbances);
            break;
        case VIEW_TYPE_FEEDBACK:
            frg = FeedbackFragment.newInstance();
            setSubTitle(R.string.title_feedback);
            break;
    }
    if (args != null) {
        frg.setArguments(args);
    }
    mCurrentFragment = frg;
    mCurrentView = i;


    getFragmentManager().beginTransaction().replace(R.id.fragment_container, frg, "ChildViewTag").commit();

}
 
开发者ID:hyperrail,项目名称:hyperrail-for-android,代码行数:42,代码来源:MainActivity.java

示例9: onItemClick

import android.app.Fragment; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

        Bundle data = new Bundle();

        Fragment newFragment = new InitiativeDetail();
        Initiative initiat = initiativeList.get(position);
        data.putParcelable(DETAIL, initiat);

        newFragment.setArguments(data);

        FragmentTransaction transaction = getActivity().getFragmentManager().beginTransaction();

        transaction.replace(R.id.container, newFragment);
        transaction.addToBackStack(null);

        transaction.commit();

}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:20,代码来源:InitiativeFragment.java

示例10: onPostExecute

import android.app.Fragment; //导入方法依赖的package包/类
@Override
protected void onPostExecute(ArrayList<Initiative> result) {
    super.onPostExecute(result);
    progDailog.dismiss();

    boolean insideList = false;
    if(fragment != null){
        insideList = true;
    }

    if(result != null) {
        if(insideList){
            fragment.getInitiativeList().clear();
            fragment.getInitiativeList().addAll(result);
            ((BaseAdapter) fragment.getmListView().getAdapter()).notifyDataSetChanged();
        }else {
            Bundle data = new Bundle();
            data.putParcelableArrayList("result", result);

            Log.v(TAG, "result= " + result);
            Fragment newFragment = new InitiativeFragment();

            newFragment.setArguments(data);

            FragmentTransaction transaction = context.getFragmentManager().beginTransaction();

            transaction.replace(R.id.container, newFragment);
            transaction.addToBackStack(null);

            transaction.commit();
        }
    }else{
        if(insideList){
            Toast.makeText(context,
                    R.string.get_initiatives_error_list, Toast.LENGTH_LONG)
                    .show();
        }else {
            Toast.makeText(context,
                    R.string.get_initiatives_error, Toast.LENGTH_LONG)
                    .show();
        }
    }
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:44,代码来源:RequestInitiativesTask.java


注:本文中的android.app.Fragment.setArguments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。