I am working with the sample code in the tutorial line by line. I have completed the sample and it does compile successfully but it (the sample code) will not run as there is an error/warning that the objects should be initialized first but I don't see where that should happen in the sample code from B4A. Any ideas what is going on?
It seem easy to follow the logic in the code but I must get past this beginning obstacle before I can go on.
What tutorial and what code are you speeking of ?
The message you get means that there is:
- a view added in the code and not initialized.
- a typo in the view name different in the code than the name given in the layout.
As NJDude alreasy pointed out, the best way to get a concrete and efficient answer is to post your code as zip file (in the IDE menu Files / Export As Zip) and at what line you get the error message.
My error referred to line 68. However klaus, you are on to something because although I don't have time to look now, my layout name may be different than what I saved the program as so I will look there when I get back.
I was just trying to give you an idea of where I was at with the code from my program which was just like the code line in the tutorial but I wasn't looking for anymore info at this point because I think Klaus hit it on the head about the layout name being different which is what I was going to do first.
If that is not the problem, I will be sure to give enough info to help you help me solve the problem.
I wasn't able to be specific as I was relating from memory because I didn't have immediate access to the program.
The layout name conflict may not have been the problem after all.
Here is a screen shot of my code as I don't know of any other way to submit code for review.
Have you defined a layout file with the name 'main' ?
To post your project you should click in the IDE menu Files / Export As Zip and post this zip file.
Ok, a couple of things, you have 2 EMPTY layouts, and you are loading and using one of them (Main), also, you have a LABEL and not an EDITTEXT to enter the results.
I have made some corrections, look at your original and the corrected one and you'll see what you did wrong.
@Gmation,
Just for your information, as you are learning with the Beginner's Guide you have all the source codes included in the SourceCode folder.
So when you have a problem you could compare your project with the original one.