0

I have done with get value from spinner to TextView. I want do reserve but I don't know how to do this.

MainActivity

When I click Edit Profile button, it intent to EditActivity EditActivity

Yup... I want to value from MainActivity replace value from Spinner in EditActivity. How can I do?

  • 1
    Possible duplicate of [How do I pass data between Activities in Android application?](https://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-in-android-application) – PPartisan Jul 02 '17 at 11:15
  • but this is spinner... not text like normal :( – Hoàng Vũ Khải Jul 02 '17 at 11:17
  • Even if it is a spinner, you should have some sort of data structure to hold the possible values (e.g., an "enum"). Or do you rely only on the spinner's text? In this case, I suggest you to revise your logic – user2340612 Jul 02 '17 at 11:19
  • @HoàngVũKhải I assume you know how to retrieve a value from the Spinner though (`spinner.getSelectedItem()`), and you know how to set a value (`spinner.setSelection(spinnerAdapter.getPosition("some text"))`), so it would simply be a case of passing text around via an intent, as usual, and applying the selected item.Alternatively, pass the index of the selected item in the intent instead. – PPartisan Jul 02 '17 at 11:25
  • @PPartisan yes.. i using getSelectedItem.toString() and pass it to textview – Hoàng Vũ Khải Jul 02 '17 at 11:31
  • oh shit it's worked, bro... thank @PPartisan so much – Hoàng Vũ Khải Jul 02 '17 at 11:34

0 Answers0