Android Question Complete novice struggling with the basics ...

Richard P

Member
Licensed User
Longtime User
I have created an activity with three views "surname", "Given name" and " date of birth" (EditText). I would like to store these user entries and display them in another layout (later with other data - little steps i think).

This is where I am stuck (idiot i know!) - i did create a 'label' in the same layout to see if i could link it with the user entry and display it that way?

Help wanted ..............
 

LucaMs

Expert
Licensed User
Longtime User
This is where I am stuck (idiot i know!)

Hello, welcome.

If "I do not know" means "I'm an idiot", we are all idiots :)

I have not understood the last part of your question (I'm probably an idiot :D).

However, for the first part, you COULD save the entered data in many ways (global variables - Process_Globals, text file, "KeyValueStore", database - better choice) or you can learn just one thing very useful: how to pass data from one Activity to another using sub routines.

If you have a data entry screen, pressing a button you could put a code like this:
B4X:
Public Sub btnEnter_Click
    CallSubDelayed2 (OtherActivityName, "SubNameInOtherActivity", SomeValue)
End Sub

In this way, after the routine in progress (that of the event of the button, in this case immediately), the second Activity will be activated (shown), more precisely the routine "SubNameInOtherActivity", which receive the parameter SomeValue.

This parameter could be a simple variable (for example a String or Int) or an Array, List or Map containing all the data entered by the user.

Then, in the Activity OtherActivityName you will have for example:
B4X:
Public Sub SubNameInOtherActivity (Value As List)
   edtRecivSurname.Text = Value.Get(0)
   edtRecivGivenName.Text = Value.Get(1)
   edtBirthday.Text = Value.Get(2)
End Sub
 
Upvote 0

Richard P

Member
Licensed User
Longtime User
Thanks for the response.

I will have a play with your suggestion - my biggest problem at the moment is the terminology used.

I shall persevere

Thanks again
 
Upvote 0
Top