Android Question Edit Text String Values

metrick

Active Member
Licensed User
Longtime User
B4X:
For i = 0 To pnlBottom.NumberOfViews - 1

  If pnlBottom.GetView(i) Is Spinner Then
  Dim spnX As Spinner
     spnX = pnlBottom.GetView(i)
     Log("spinner =" & spnX.SelectedItem)

     End If
     If pnlBottom.GetView(i) Is EditText Then
     Dim etX As EditText
     etX.Initialize("etX")
     etX.Text = pnlBottom.GetView(i)
     Log(etX.Text)
     End If
 Next
How can I get an text value entry(string) in edit text with for loop?
With the above code I can get correct spinner selectedItem value but get "android.widget.EditText@427e01a8" with EditText.
 

stevel05

Expert
Licensed User
Longtime User
That's because your assigning the view to etX.text with

B4X:
etX.Text = pnlBottom.GetView(i)

and android.widget.EditText@427e01a8" with EditText. is the text representation of it.

You should be doing:

B4X:
etX = pnlBottom.GetView(i)
log(etX.Text)

If pnlBottom is a working panel, then you shouldn't be initializing etX either.
 
Upvote 0

metrick

Active Member
Licensed User
Longtime User
That's because your assigning the view to etX.text with

B4X:
etX.Text = pnlBottom.GetView(i)

and android.widget.EditText@427e01a8" with EditText. is the text representation of it.

You should be doing:

B4X:
etX = pnlBottom.GetView(i)
log(etX.Text)

If pnlBottom is a working panel, then you shouldn't be initializing etX either.
Thank you. That's working.
 
Upvote 0
Top