Attempt to invoke virtual method 'void com.wealthfront.magellan.ScreenContainer.setInterceptTouchEvents(boolean)' on a null object reference
cervebar opened this issue · 2 comments
Hi wealthfront/magellan team.
I'm working with one old (2years) project, which uses your library and I'm getting this errors:
Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'void com.wealthfront.magellan.ScreenContainer.setInterceptTouchEvents(boolean)' on a null object reference
com.wealthfront.magellan.Navigator.navigate
It's happening time-to-time when users go back next day or after some time back to app. Do you have any idea what can cause this? Have you ever face similar issues?
It' seem activity is null in time when navigator calls navigate, but have no clue why.
full stacktrace:
com.wealthfront.magellan.Navigator.navigate (Navigator.java:537)
com.wealthfront.magellan.Navigator.navigateTo (Navigator.java:519)
com.wealthfront.magellan.Navigator.goTo (Navigator.java:405)
com.cfhero.android.MainActivity.setupReceivedIntent (MainActivity.java:167)
com.cfhero.android.MainActivity.onCreate (MainActivity.java:42)
android.app.Activity.performCreate (Activity.java:8066)
android.app.Activity.performCreate (Activity.java:8054)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1313)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3733)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3939)
android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:91)
android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:149)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:103)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2373)
android.os.Handler.dispatchMessage (Handler.java:107)
android.os.Looper.loop (Looper.java:213)
android.app.ActivityThread.main (ActivityThread.java:8147)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:513)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1101)
Other and maybe related or maybe not issue is:
Unable to add window -- token android.os.BinderProxy@dee61ea is not valid; is your activity running? com.cfhero.android.badges.BadgeUtilities.showBadgeRewardDialog
Thanks for any help
Thanks for reaching out! That’s definitely strange.
From the stack trace, it looks like you’re navigating in a method called from Activity#onCreate
. Have you checked that setupReceivedIntent
is called after Navigator#onCreate
? That’s where the activity and container are set, so navigating before that would cause the exception you’re experiencing.
Thanks for answer and help,
I was debugging the issue and it seems that the problem was with that Navigator activity is assigned by SignalActivity
in time when the method onPostCreate
is called (not onCreate
).
So basically we moved our method in MainActivity to different phase like this:
override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onPostCreate(savedInstanceState, persistentState)
setupReceivedIntent()
}