Android Question "object should first be initialized" when using FontAwesome

Ravensclawth

Member
Licensed User
Hello, I am a beginner having a lot of fun with B4A. I was thrilled when 6.5 beta came out, downloaded it and installed it this morning. I couldn't wait to try out the FontAwesome.

I opened the SecondProgram code (tutorial) that I finished last night, that has been working perfectly. I decided to set the BS (backspace) button to a FontAwesome < intead of text "<".

It shows up great on the designer. It compiles fine. However, when I run it, I get Java messages "object (button) should first be initialized". If I continue, the BS button is missing. I am only modifying the button through the designer.

Even though it says not to, I did try adding a Private btnBS as button, and issuing btnBS.Initialize(""), with the same results. I removed that code, made sure everything was saved, recompiled and tried again with the same results.

If I remove the FontAwesome and set it back to NORMAL with text "<" it compiles and runs without error.

What am I missing? Thank you for an awesome product!
 

DonManfred

Expert
Licensed User
What am I missing?
Posting your project. Without seeing your code it is hard to give advices.

In the IDE unter File->Export as zip. Upload this zip then.

Views added by the the designer are initialized when you use LoadLayout(). You dont need to initialize views added by designer but make sure you are loading the right layout.

If you initialize a button in code then you need to add the button to a layout by code
 
Upvote 0

Ravensclawth

Member
Licensed User
Here is the zip. I am only using the designer.

If I change the button btnBS FontFace to FontAwesome, and choose a FontAwesome Icon I get this message during runtime:

"An error as occurred in sub: Main_activity_create (java line: 342) Java.lang.RuntimeException: Object should first be initialized (button)

If I change the Fontface of to the button back to DEFAULT, and text to "<", it runs without an error.

Thanks for looking at this!
 

Attachments

  • SecondProgram_w_FW.zip
    164.2 KB · Views: 251
Upvote 0

Ravensclawth

Member
Licensed User
Could this perhaps be an Android version problem?

My cheap phone I bought to test on is Android 4.1.2 I tried running it on my older tablet (Android 4.0.4) and got the same error.

This time, however, it did generate a log, which I've attached.
 

Attachments

  • err.txt
    4.8 KB · Views: 264
Upvote 0

Ravensclawth

Member
Licensed User
It failed to load the font file for some reason.

Do you see the icon when you connect the designer to the device?
Try to clean the project (Ctrl + P) and run it again.

I do see the icon when I'm connected to the designer. I did Ctrl+P, and recompiled, but still get the same error.
Is there a minimum version JDK I need to run?

I do note that I am running the earlier JDK from when I first installed this in 2014. (Guess It was a while before I started to play with it!) I was planning to try updating JDK in the morning.
 
Upvote 0

Ravensclawth

Member
Licensed User
SOLVED. Thank you, Erel, for all your help!

My problem turned out to be my Android SDK. As soon as I completely uninstalled my version 23.0.1 and updated it to the latest version 25.0.1, both your test program and my program compiled and ran without a problem!

I used the link on the B4A main page: https://www.b4x.com/b4a.html

and downloaded the newer Android SDK in the link found under installation, Android SDK.

Thank you!
 
Upvote 0
Top