S Sreenadh OG Member Licensed User Longtime User Dec 4, 2014 #1 Hai, I have a Button to add EditText dynamically, now I want to get text from all created EditText. My code is given below.. Code: 'Dim i as Int 'i=80 'Dim txt as EditText Sub BtnAdd_Click txt.Initialize("") Activity.AddView(txt,10,i,40,30) i=i+30 End Sub Sub btnnew_Click Dim str As String str=txt.Text ' here i want to get all text as array End Sub Last edited: Dec 4, 2014
Hai, I have a Button to add EditText dynamically, now I want to get text from all created EditText. My code is given below.. Code: 'Dim i as Int 'i=80 'Dim txt as EditText Sub BtnAdd_Click txt.Initialize("") Activity.AddView(txt,10,i,40,30) i=i+30 End Sub Sub btnnew_Click Dim str As String str=txt.Text ' here i want to get all text as array End Sub
DonManfred Expert Licensed User Longtime User Dec 4, 2014 #2 Use a global list (or map) to store all created EditText-objects You then can use this list, to get all texts from the edits stored in this list... Code: ' in globals dim editlist as list ' in activity create editlist.initialize Code: Sub BtnAdd_Click dim txt as EditText txt.Initialize("txt") Activity.AddView(txt,10,i,40,30) editlist.add(txt) i=i+30 End Sub Code: Sub btnnew_Click For Each txt As EditText In editlist ' get the text from edit here Dim content As String = txt.Text Next End Sub Upvote 0
Use a global list (or map) to store all created EditText-objects You then can use this list, to get all texts from the edits stored in this list... Code: ' in globals dim editlist as list ' in activity create editlist.initialize Code: Sub BtnAdd_Click dim txt as EditText txt.Initialize("txt") Activity.AddView(txt,10,i,40,30) editlist.add(txt) i=i+30 End Sub Code: Sub btnnew_Click For Each txt As EditText In editlist ' get the text from edit here Dim content As String = txt.Text Next End Sub
DonManfred Expert Licensed User Longtime User Dec 4, 2014 #4 Click on like if my answer was useful for you Upvote 0
S Sreenadh OG Member Licensed User Longtime User Dec 5, 2014 #5 hai, I want to delete Dynamically created EditText on Button_click, How can i delete each EditText for each Button_click Upvote 0
hai, I want to delete Dynamically created EditText on Button_click, How can i delete each EditText for each Button_click
DonManfred Expert Licensed User Longtime User Dec 5, 2014 #6 have a look at Code: Activity.RemoveViewAt . Your need to find out which position your view ihas n the list of all Activity-views first. Set a special TAG to the edittexts and have a look at Code: for Each v As View In Activity.GetAllViewsRecursive Next too Upvote 0
have a look at Code: Activity.RemoveViewAt . Your need to find out which position your view ihas n the list of all Activity-views first. Set a special TAG to the edittexts and have a look at Code: for Each v As View In Activity.GetAllViewsRecursive Next too