Skip to content Skip to sidebar Skip to footer

Pass Data From Dialog To New Activity

I am trying pass data from my dialog box to a new Activity. So basically what i want to do for example in my Dialog box i have Name: John, when i click on my okay button it opens a

Solution 1:

Pass in as an extra:

instead of:

Intent i = newIntent(getActivity().getApplicationContext(),Upvalence.class);
startActivity(i);

you should pass in the name

Intent i = newIntent(getActivity().getApplicationContext(),Upvalence.class);
i.putExtra("string", SlectedName);
startActivity(i);

Then, on your Upvalence activity:

@OverrideprotectedvoidonCreate(@Nullable Bundle savedInstanceState) {
    Bundlearguments = this.getIntent().getExtras();
    String yourString = arguments.getString("string");
 }

Post a Comment for "Pass Data From Dialog To New Activity"