Android Question edittext

Laurie

Member
Licensed User
Longtime User
Is it possible to automatically copy text entered into one EditText field into a second EditText field?
 

Mahares

Expert
Licensed User
Longtime User
Are you looking for something like this or am I too simplistic.
B4X:
Sub txtTest2_EnterPressed
    txtTest.Text=txtTest2.Text 'txttest mimics txttest2
End Sub
 
Upvote 0

Laurie

Member
Licensed User
Longtime User
Thanks Mahares, but my problem is that I am using a group of EditText inputs - ie EdTxt.Text which are usually identified by edt = Sender
They do each have their own tag ie EdTxt.Tag = 1 to 36 for example. But I don't know how to address a particular EdTxt.

Setting EdTxt.Tag = the EditText I want to write to and then EdTxt.Text="New Value" doesn't work
 
Upvote 0

Laurie

Member
Licensed User
Longtime User
My EditText views are all a panel but I'm afraid I still don't understand how to achieve my objective. Let's assume I have a number, say "99" that I want to enter into a specific EditText box programmatically. What should the code be?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In the Panel your EditText views have an index.
If you add EditText1, EditText2, EditText3 ... and so on.
EditText1 has index 0, EditText2 has index 1, EditText3 has index 2, ... and so on
So if you want to set the text "99" to EditText45:
B4X:
Dim edt As EditText
edt = Panel1.GetView(44)
edt.Text = "99"
 
Last edited:
Upvote 0

Laurie

Member
Licensed User
Longtime User
Thanks Klaus, that works brilliantly. Really appreciate everyone's input and the speed of response to appeals for help!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…