當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。