Android Question tabhost error..please assist

apty

Active Member
Licensed User
Longtime User
i have a tabhost where i am loading some layout files. The tabhost works fine and loads the edittexts that are in the layouts. The problem is when i try to add values to the texboxes programmatically, i get "object should first be initialized(edittext)" error.

e.g, after loading the layouts via tabhost, when i do
B4X:
edittext1.Text="somevalue"

i get the error. What could be the cause?
 

apty

Active Member
Licensed User
Longtime User
This is the code on activity_create
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("parceldetails")
    TabHost1.AddTab("Description","parcelnew")
    TabHost1.AddTab("Location", "parcelnew2")
   
    txtDelvery.Text=Main.newvalue
   
 
End Sub
The parcelnew layout file has txtDelvery edittext. The Main module has the "newvalue" variable defined in Process_Globals which is later assigned a value before being passed to this module with error. If i do
B4X:
Msgbox(Main.newvalue,"Test")
in this module, i can see the newvalue but assigning it to an edittext says that the edittext must be initilialized, yet the edittext was added in the designer
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
Thanks guys. I managed to see where my error was coming from.I had mixed up some layout files which caused the error
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…