Still working on my skills in android.
My problem here is that i have a label from my database that contain a name that is in a spinner, when i click on the label, a dialog comes and give you three choices:
1. update.
2. delete.
3. cancel.
I got through the second and the third choices, but in the update am facing this problem;
i go to another activity that has an editText and the 2 Buttons, save and cancel, i want the save button to get the data from the editText in putExtra and send it back to the same previous activity and change the old label with the data from the editText.
I appreciate any help.
Thanks in advance.
In your second activity, you can get the data from the first activity with the method
getIntent()and thengetStringExtra(),getIntExtra()…Then to return to your first activity you have to use the
setResult()method with the intent data to return back as parameter.To get the returning data from your second activity in your first activity, just override the
onActivityResult()method and use the intent to get the data.First Activity:
Second Activity:
Don’t forget to start your second activity with the
startActivityForResult()method.