Fragment fragment = new Fragment(); Bundle bundle = new Bundle(); bundle.putInt(key, value); fragment.setArguments(bundle);
Fragment fragment = new Fragment(); Bundle bundle = new Bundle(); bundle.putInt(key, value); fragment.setArguments(bundle);
Bundle bundle = new Bundle(); bundle.putString("address", "sms.get(position).getmAddress()"); // set Fragment Arguments Fragment fragment = new Fragment(); fragment.setArguments(bundle);
public class MyDialogFragment extends DialogFragment { public static final String MESSAGE = "message"; public static final String TITLE = "title" public static final String ICON_ID = "icon_id" public static MyDialogFragment newInstance(String title, String message, int iconId) { Fragment f = new Fragment(); Bundle b = new Bundle(); // fill up b f.setArguments(b); return f; } }
Bundle extras1 = new Bundle(); extras1.putString("productId", productId); extras1.putString("ddsId", id1); Fragment fg = new Fragment(); fg.setArguments(extras1);
@Override public void sendData(Bundle data) { Fragment oneFr = new Fragment(); oneFr.setArguments(data); fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.frag_container, oneFr); fragmentTransaction.commit(); }
Fragment fragment = new Fragment(); // replace your custom fragment class Bundle bundle = new Bundle(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); bundle.putString("key","value"); // use as per your need fragment.setArguments(bundle); fragmentTransaction.addToBackStack(null); fragmentTransaction.replace(viewID,fragment); fragmentTransaction.commit();
Fragment fragment = new Fragment() { @Override public void onAttach(Activity activity) { super.onAttach(activity); if(getArguments() != null) { String scanContent = getArguments().getString("scanContent"); } } }; Bundle bundle = new Bundle(); bundle.putString("scanContent", scanContent); fragment.setArguments(bundle);
Fragment fragment = new Fragment(); Bundle bundle = new Bundle(); bundle.putString(key, value); fragment.setArguments(bundle);
Fragment fragment = new Fragment(); Bundle args = new Bundle(); args.putString("value", key); fragment.setArguments(args);
Bundle b = new Bundle(); b.putString("data", "abc"); // set Fragmentclass Arguments Fragment frag = new Fragment(); frag.setArguments(b);
Fragment fragment = new Fragment(); // replace your custom fragment class Bundle bundle = new Bundle(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); bundle.putString("key","value"); // use as per your need fragment.setArguments(bundle); fragmentTransaction.addToBackStack(null); fragmentTransaction.replace(viewID,fragment); fragmentTransaction.commit();
Fragment fragment = new Fragment(); Bundle bundle = new Bundle(); bundle.putString(key, value); fragment.setArguments(bundle);
Fragment fragment = new Fragment(); Bundle bundle = new Bundle(); bundle.putInt(key, value); fragment.setArguments(bundle);
Bundle args = new Bundle(); Fragment frag = new Fragment(); args.putInt("name", num); frag.setArguments(args); fragmentTransactionFinish.add(R.id.TextView1, frag); fragmentTransactionFinish.commit();
final Fragment fragment = new Fragment(); if(position == items.size()-1){ final Bundle args = new Bundle(); args.putBoolean("isLast",true); fragment.setArguments(args); } return fragment;
// private method called during option select... private void onOptionClickDoSomething() { Fragment myFragment = new Fragment(); Bundle args = new Bundle(); args.putCharSequence("key", someStringValue); myFragment.setArguments(args); // attach args to the Fragment // invoke a transaction FragmentManager fm = getSupportFragmentManager(); // assume using support library FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.myFragmentContainer, myFragment); ft.commit(); }
Fragment fragment = new Fragment(); Foo foo = new Foo(); Bundle bundle = new Bundle(); bundle.putParcelable("Foo", foo); fragment.setArguments(bundle);
Fragment fragment = new Fragment(); final Bundle bundle = new Bundle(); bundle.putString("data", data); Log.i("BUNDLE", bundle.toString()); fragment.setArguments(bundle);
@Override public void sendData(String data) { // TODO Auto-generated method stub Fragment fragment = new Fragment(); final Bundle bundle = new Bundle(); bundle.putString("data", data); Log.i("BUNDLE", bundle.toString()); fragment.setArguments(bundle); }