Android Question Why i am getting this error and how to fix it

Mehrzad238

Active Member
I have a receiver for a Timer, and it works, but while that receiver is active, I get a two-line error for every Tick the timer makes. why?

B4X:
Error creating activity intent: Attempt to read from field 'java.lang.String anywheresoftware.b4a.BA.className' on a null object reference in method 'java.lang.Class anywheresoftware.b4a.keywords.Common.getComponentClass(anywheresoftware.b4a.BA, java.lang.Object, boolean)'
Error getting service class: Attempt to read from field 'java.lang.String anywheresoftware.b4a.BA.className' on a null object reference in method 'java.lang.Class anywheresoftware.b4a.keywords.Common.getComponentClass(anywheresoftware.b4a.BA, java.lang.Object, boolean)'

When I disable the timer, it stops

So first of all, what is this, and why am I getting this error?
Second, how can I fix it?

Here is my info, and the project is B4Xpages.

B4X:
B4A Version: 13.40
Parsing code.    (0.08s)
    Java Version: 19
Building folders structure.    (0.06s)
Running custom action.    (0.06s)
Compiling code.    (0.09s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.47s)
Linking resources    (1.15s)
    build tools: 36.0.0, android jar: android-36
Compiling generated Java code.    (0.08s)
Finding libraries that need to be dexed.    (0.01s)
Dex code    (0.94s)
Dex merge    (4.15s)
Copying libraries resources    (1.61s)
ZipAlign file.    (0.05s)
Signing package file (private key).    (0.54s)
Installing file to device.    (6.70s)
    Installing with B4A-Bridge.
Completed successfully.

Thanks for any help
 
Last edited:
Solution
Sorry for taking so long to reply, so here is what happened:

I was trying to make a timer, since a timer needs to run in the background, so I put the milliseconds and the timer in the receiver, and in UI, I put a button to start and stop the timer, and when the timer was done (reached 0) I was calling stop_click in the receiver, which is why I was getting thos errors and the soulotion base on chatgpt, it was to use a service and we already had one(Starter) when I use that the problem was solved


every Tick
And for this part, it was about the This library to show live how much is left from the timer(from 100% to 0), and this library was called in timer_tick in the receiver for every second

Mehrzad238

Active Member
The thread title should be informative.
Next time, but I explained in the context: "I have a receiver for a Timer, and it works, but while that receiver is active, I get a two-line error for every Tick the timer makes."
If that is not enough, when I get home, I will upload the whole project to see for yourself
 
Upvote 0

emexes

Expert
Licensed User
Longtime User
Here is my info

If the errors occur for every tick the timer makes, then the first place to look would be the timer tick event handler sub.

Without seeing that code, it is hard to say why you're getting the error and how to fix it.
 
Upvote 0

Mehrzad238

Active Member
Sorry for taking so long to reply, so here is what happened:

I was trying to make a timer, since a timer needs to run in the background, so I put the milliseconds and the timer in the receiver, and in UI, I put a button to start and stop the timer, and when the timer was done (reached 0) I was calling stop_click in the receiver, which is why I was getting thos errors and the soulotion base on chatgpt, it was to use a service and we already had one(Starter) when I use that the problem was solved


every Tick
And for this part, it was about the This library to show live how much is left from the timer(from 100% to 0), and this library was called in timer_tick in the receiver for every second
 
Upvote 0
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…