What mean this initialize object message?

Gmation

Member
Licensed User
Longtime User
Hey guys,

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.

Thanks
 

klaus

Expert
Licensed User
Longtime User
I am working with the sample code in the tutorial line by line.
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.

Best regards.
 
Upvote 0

Gmation

Member
Licensed User
Longtime User
OK thank you guys,

I was referring to the code from the tutorial guide
http://www.b4x.com/android/files/guide.zip

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.

Thanks again to you both :)
 
Upvote 0

Gmation

Member
Licensed User
Longtime User
Thanks NJDude for your assistance.

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.
 
Upvote 0

Gmation

Member
Licensed User
Longtime User
OK Guys,

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.

code1.gif

Thanks in advance
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You can EXPORT your project as a ZIP file and then upload it to the forum.

On the designer's menu bar click on FILE -> EXPORT AS ZIP.

See attached picture.
 

Attachments

  • Export.JPG
    Export.JPG
    10.7 KB · Views: 350
Upvote 0

Gmation

Member
Licensed User
Longtime User
Thanks guys as I appreciate your patience,

I believe I did indeed save the project as main and named the layout as main.

Here is the zip file
 

Attachments

  • StarterCode.zip
    7.6 KB · Views: 321
Upvote 0

NJDude

Expert
Licensed User
Longtime User
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.
 

Attachments

  • NewProject.zip
    7.2 KB · Views: 291
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
@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.

Best regards.
 
Upvote 0

Gmation

Member
Licensed User
Longtime User
Thanks Guys! You Rock:)

I will try not to be a big bother but I really dig this stuff and I do appreciate your help.

Best regards
 
Upvote 0
Top