COMPILING ERROR unknown member?

AntonBrz

Member
Licensed User
Just bought B4A two days ago. I'm sorry if this is a newbie question, but who else can I ask? I created several views in the designer, with buttons or images, they show up correctly on the emulator from designer, and made sure to save them. Yet when i try to compile any of these tests I get the following error, "unkown member" What's up?



Parsing code. 0.02
Compiling code. Error
Error compiling program.
Error description: Unknown member: loadlayout{example}
Occurred on line: 34
Activity.LoadLayout{example}
Word: loadlayout{example}
 

Mark Read

Well-Known Member
Licensed User
Welcome to the forum.

Can you post your code please!

Regards
Mark
 
Upvote 0

AntonBrz

Member
Licensed User
Here is the code;

(This is just what you get with you start a new program and save it. A program with an image added. My name for the view file created in the designer matches the file name, when I try different names and watch capitalization, tried different names, ie test, mytest, example, even dufensmertz. Always get that unknown member error.

#Region Project Attributes
#ApplicationLabel: My First B4A Program
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True

#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout")
Activity.LoadLayout{mytest}
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
'
'This Is Activity crude attmpt
'To learn To use the editor AND the virtual device In Basic For Android
'
 
Upvote 0

warwound

Expert
Licensed User
Replace
B4X:
Activity.LoadLayout{mytest}
by
B4X:
Activity.LoadLayout(mytest)
You should use code tags to show code with the # button.

Best regards.

Shouldn't mytest be contained within quotes:

B4X:
Activity.LoadLayout("mytest")

mytest doesn't seem to be a String variable so should be quoted.

Martin.
 
Upvote 0

AntonBrz

Member
Licensed User
changing the brackets worked

Thank you. when I changed {.... } to ( ... ) it longer gave a member not found code. However it gave another error:

Parsing code Error
Error parsing program.
Error description: Undeclared variable 'test' is used before it was assigned any value.
Occurred on line: 33
Activity.LoadLayout(test) error on compiling.

Do I say "Dim test As Test" ---or "Dim Test As test?"
 
Upvote 0

AntonBrz

Member
Licensed User
Never mind, it worked when I...



Never mind, I inserted "DIM test AS String" up top in the globals, and it compiles fine. I'm a newbie, tremendously excited. I've been trying to write Android programs for weeks using Titanium Eclipse and never got anything to run! Wren I saw it compile I joyfully shouted "It works, it works!: Kind of like Colin Clive in the 1931 Frankenstiein.
 
Upvote 0

AntonBrz

Member
Licensed User
Final Problem I hope

My "Nevermind' was premature. Yes, the app did compile without error. And the icon for the test appeared in the Virtual Android apps screen, BUT when I tired to run it, then virtual Android went black with the spinning indicator for a long time, then said it couldn't find the designer test file, just as the compiler had, although now it passes the compiler without error. Should I find the file it need and put it in my project file where the resources are?
 
Upvote 0

MLDev

Active Member
Licensed User
Remove "DIM test AS String" and change this:

B4X:
Activity.LoadLayout(test)

To this:

B4X:
Activity.LoadLayout("test")
 
Upvote 0
Top