So, I have 2 activities one has Labels 3 - 8, and the second is a carbon copy of the first but with the Float Labeled Edit Text 3 - 8. I want to be able to save any edit text labels on activity 2 using a save button so that the activity 1 shows the edited labels.
Any idea how I do this? I'm not really confident with what I've come up with:
B4X:
Sub FloatLabeledEditText1_TextChanged (Old As String, New As String)
Activity1.Label3 = FloatLabeledEditText1
End Sub
Maybe you can store the texts in a service like "starter" in a field. So you can have a copy of the text in labels to get when the activity starts or resumes.
I don't know if this is what you are looking for...
Ciao
Mauro
Hi Erel, I appreciate all your help on this, but as usual, I'm struggling. I am probably wrong in what I have done with your code that you sent me. I feel like I've missed something in the Activity 2 Show Data sub?
I keep getting an error: java.lang.Exception: Sub button2_click signature does not match expected signature.
Activity 1: (Zone)
B4X:
Sub Button2_Click
'This call will bring Activity2 to front and will then execute ShowList
CallSubDelayed2(EditZones, "ShowData", CreateMap("value3": Label3.Text, "value4": Label4.Text, "value5": Label5.Text, "value6": Label6.Text, "value7": Label7.Text, "value8": Label8.Text))
End Sub
Sub GetResult(values As Map)
Label3.Text = values.Get("value1")
End Sub
Activity 2: (EditZones)
B4X:
Sub ShowData(values As Map)
FloatLabeledEditText1.Text = values.Get("value3")
FloatLabeledEditText2.Text = values.Get("value4")
FloatLabeledEditText3.Text = values.Get("value5")
FloatLabeledEditText4.Text = values.Get("value6")
FloatLabeledEditText5.Text = values.Get("value7")
FloatLabeledEditText6.Text = values.Get("value8")
End Sub
Sub Button2_Click (Position As Int, Value As Object)
CallSubDelayed2(Zone, "GetResult", Value)
End Sub
The code you posted in post #7 is incorrect as the signature of the button click event is wrong. If you fix it and you are still getting this error then you should post the updated code. Preferably upload the project (File - Export as zip).