Android Question Changing EditText

driesvp

Member
Licensed User
Longtime User
Dear all,

How can a value be passed to an EditText?

Detailed:
In Main, a sub load a layout with an EditText. Another module passes through Callsub2 a value to this EditText by the sub mentioned above. But I can get the value assigned to this EditText.

Thanks!
 

driesvp

Member
Licensed User
Longtime User
I'll give it a try:

Module Test:
CallSub3(Main, "Detail", Data,"Alarm1")

Module Main:
Sub Globals

Dim txtFirst As EditText
Dim txtSec As EditText

End Sub

Sub Detail(first As String,sec As String)
Activity.LoadLayout("detail")
txtFirst.Text=first
txtSec.Text=sec

End Sub


both txtFirst and txtSec are EditText on layout "detail"
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
I'll give it a try:

Module Test:
CallSub3(Main, "Detail", Data,"Alarm1")

Module Main:
Sub Globals

Dim txtFirst As EditText
Dim txtSec As EditText

End Sub

Sub Detail(first As String,sec As String)
Activity.LoadLayout("detail")
txtFirst.Text=first
txtSec.Text=sec

End Sub


both txtFirst and txtSec are EditText on layout "detail"


The sub in Main named Detail is looking for two Strings as the parameters. Your third parameter in your CallSub3 is Data, this should be a string or a string variable. You should log() the values of first and sec and see if they are sending the data you are looking for to the log. If the types are correct, it should work. Also, how do you get the module Test to run? It is not an Activity, so the Main must call it or a function in it, which in turn calls "Detail".
 
Last edited:
Upvote 0

driesvp

Member
Licensed User
Longtime User
Dear,

Data is indeed a string. When running the code I receive an error "object should first be initialized" if the code hits the line txtFirst.Text=first
 
Upvote 0

driesvp

Member
Licensed User
Longtime User
Problem partially solved: it works with labels but still not with edittext. I let it rest!

Thanks for your help!
 
Upvote 0
Top