I have a button when clicked it checks to make sure there is text in the edittext box. But I get an error saying the edittext box needs to be initialized. Can someone give me of an example of how to do this?
1) Did you add the EditBox using the designer or programatically
2) How are you checking its contents
3) What does the error ACTUALLY say
4) As said on numerous occasions, post some code that demonstrates the error.
Sorry. They were added through the designer. The error:
An error has occurred in sub: Main_btnsend_click (B4A line: 52) If etareacode.text.length > 0 and etprefix.text.length = 0 then java.lang.runtimeexception:Object should first be initialized(EditText).
Code below:
B4X:
If lblfilename.Text.Length = 0 Then
If etareacode.Text.Length > 0 AND etprefix.Text.Length = 0 Then
Msgbox("Please enter a Prefix in the box.","Missing Prefix")
End If
1) In the layout that is loaded (check the names are the same)
2) There is a Dim statement for it/them in Sub Globals (again check the names carefully)
The only way I can see this error is if I Dim an EditText that has not been added via a designer layout.