WM24 - Android error
April 26, 2021 12:42PM
Hi,

every now and then my app crashes with the error below. With other error I see a line of code mentioned, which give m e a clue to solve the issue. But not in this case, see errortext below .The users tell me that they 'close a window' to get back to the main/first window.

Does anyone have a clue?

===== Error =====
Date and time=23/04/2021 14:43:33
Message=Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.Button.getBackground()' on a null object reference
Java stack=fr.pcsoft.wdjava.ui.champs.bouton.f.drawableStateChanged(Unknown Source:15)
android.view.View.refreshDrawableState(View.java:24276)
android.view.View.onWindowFocusChanged(View.java:14702)
android.widget.TextView.onWindowFocusChanged(TextView.java:11925)
android.view.View.dispatchWindowFocusChanged(View.java:14658)
android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1502)
android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1502)
android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1502)
android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1502)
android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:3479)
android.view.ViewRootImpl.access$1300(ViewRootImpl.java:205)
android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:5385)
android.os.Handler.dispatchMessage(Handler.java:107)
android.os.Looper.loop(Looper.java:237)
android.app.ActivityThread.main(ActivityThread.java:8154)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Thread=id=2
name=main
priority=5
groupName=main

Arie
Argus
Re: WM24 - Android error
April 26, 2021 02:27PM
Message=Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.Button.getBackground()' on a null object reference


This message makes me think that your code is attempting to access a control of the window AFTER it has been closed by the system...

So either in the closing button code itself OR in a timer/thread, there could be something accessing the window too late and/or without verifying that the window is open
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: