Android Question multiple edittext in scrollview

imadreem

New Member
Licensed User
Hello everyone


i am using multiple edittext in a scrollview
when checking for enterpressed or gotfocus i always get the data of the last edittext in the scrollview not the one i am using

Please help
 

imadreem

New Member
Licensed User
How do you add the EditText views in the ScrollView ?
1689854370040.png

above code is for defining edittext

1689854497083.png

and here i retrive it when enter is pressed
 
Upvote 0

zed

Active Member
Licensed User
Use code tags </> to display code.

Something like that.
B4X:
Dim edtxt(listitems.size) As B4XView 'number of edittext
For i = 0 To listitems.size -1 'your list
    Dim myEdTXT As EditText
    myEdTXT.Initialize("etView")
    edTXT(i) = myEdTXT
    edtxt(i).Tag = i
Next
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Tip: It's almost always better to use CustomListView instead of ScrollView. Even in your case, since it seems to me that all elements have the same layout (which would be better to load from file).
 
Last edited:
Upvote 0

imadreem

New Member
Licensed User
Use code tags </> to display code.

Something like that.
B4X:
Dim edtxt(listitems.size) As B4XView 'number of edittext
For i = 0 To listitems.size -1 'your list
    Dim myEdTXT As EditText
    myEdTXT.Initialize("etView")
    edTXT(i) = myEdTXT
    edtxt(i).Tag = i
Next
thank you Zed
i used your code and it is working perfect
 
  • Like
Reactions: zed
Upvote 0
Top