NativeScript tends to replace fragments rather than destroy the entire activity; so everything lives in a single activity. Unfortunately; when navigating pages the fragment might not be fully detached while the other one is being added (for animation purposes) and it throws this error:
Stacktrace
System.err: Attempt to invoke virtual method ‘void com.scichart.drawing.opengl.ao.a(int, int)’ on a null object reference
System.err:
System.err: StackTrace:
System.err: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.scichart.drawing.opengl.ao.a(int, int)’ on a null object reference
System.err: at com.scichart.drawing.opengl.aa.doFrame(SourceFile:88)
System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909)
System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:723)
System.err: at android.view.Choreographer.doFrame(Choreographer.java:655)
System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
System.err: at android.os.Handler.handleCallback(Handler.java:790)
System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
System.err: at android.os.Looper.loop(Looper.java:164)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I have tried using suspendUpdates on the surface to stop any updates; and finally went to where I have to manually remove it from the viewport before destruction occurs.
Is their any way to potentially catch this error and ignore it. It only happens during a destruction sequence that the SciChart doesn’t like. Or is their some way to stop all drawing so that it isn’t trying to call whatever is in SourceFile line 88
Also is their a better place to report stack traces for crashes?
- You must login to post comments
Hi Nathanael,
Can you try to switch to RenderSurface which uses Canvas API for rendering chart? I believe this error can be caused by the fact that we use separate thread for rendering with OpenGL and it looks like that this thread isn’t stopped and tries to draw chart after you try to detach fragment with chart.
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 4 years ago
-
I’ll test that, thanks for the idea — is their any calls I can make that can suspend/shut the background thread down if I prefer to use OpenGL because of the speed?
-
If you switch to RenderSufaceGL which is based on GlSurfaceView you can use methods provided by Android SDK such as onResume()/onPause() which resume/pause GLThread. But these calls are asynchronous so suspend/resume will take some time. As for GLTextureView ( the default implementation in v3 ) – there is no way to manipulate GLThread for this type of RenderSurface.
- You must login to post comments
Please login first to submit.