Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE on updateConfiguration() method #30

Open
JcMinarro opened this issue Jan 28, 2020 · 0 comments · May be fixed by #31
Open

NPE on updateConfiguration() method #30

JcMinarro opened this issue Jan 28, 2020 · 0 comments · May be fixed by #31

Comments

@JcMinarro
Copy link
Owner

updateConfiguration() method is called from the parent constructor, so our baseResources is not initialized yet and we get a NPE using it

 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.content.res.Resources.updateConfiguration(android.content.res.Configuration, android.util.DisplayMetrics)' on a null object reference
        at com.jcminarro.philology.PhilologyResources.updateConfiguration(PhilologyResources.kt:65)
        at android.content.res.Resources.<init>(Resources.java:257)
        at android.content.res.Resources.<init>(Resources.java:234)
        at com.jcminarro.philology.PhilologyResources.<init>(PhilologyResources.kt:25)
        at com.jcminarro.philology.PhilologyContextWrapper$res$2.invoke(PhilologyContextWrapper.kt:17)
        at com.jcminarro.philology.PhilologyContextWrapper$res$2.invoke(PhilologyContextWrapper.kt:11)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.jcminarro.philology.PhilologyContextWrapper.getRes(PhilologyContextWrapper.kt)
        at com.jcminarro.philology.PhilologyContextWrapper.getResources(PhilologyContextWrapper.kt:21)
        at android.content.ContextWrapper.getResources(ContextWrapper.java:86)
        at android.content.ContextWrapper.getResources(ContextWrapper.java:86)
        at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:74)
        at androidx.appcompat.app.AppCompatActivity.getResources(AppCompatActivity.java:543)
        at android.view.Window.getDefaultFeatures(Window.java:1306)
        at android.view.Window.<init>(Window.java:453)
        at com.android.internal.policy.impl.PhoneWindow.<init>(PhoneWindow.java:290)
        at com.android.internal.policy.impl.Policy.makeNewWindow(Policy.java:60)
        at com.android.internal.policy.PolicyManager.makeNewWindow(PolicyManager.java:57)
        at android.app.Activity.attach(Activity.java:5932)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2259)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
        at android.app.ActivityThread.access$800(ActivityThread.java:151) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.app.ActivityThread.main(ActivityThread.java:5254) 
        at java.lang.reflect.Method.invoke(Native Method

Originally posted by @antercepter in #29

@JcMinarro JcMinarro linked a pull request Feb 1, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant