SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


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:

System.err: Attempt to invoke virtual method ‘void, int)’ on a null object reference
System.err: StackTrace:
System.err: java.lang.NullPointerException: Attempt to invoke virtual method ‘void, int)’ on a null object reference
System.err: at com.scichart.drawing.opengl.aa.doFrame(SourceFile:88)
System.err: at android.view.Choreographer$
System.err: at android.view.Choreographer.doCallbacks(
System.err: at android.view.Choreographer.doFrame(
System.err: at android.view.Choreographer$
System.err: at android.os.Handler.handleCallback(
System.err: at android.os.Handler.dispatchMessage(
System.err: at android.os.Looper.loop(
System.err: at
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at$
System.err: at

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?

3(Latest from
  • You must 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,

  • Nathanael Anderson
    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?
  • Yura Khariton
    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 to post comments
Showing 1 result
Your Answer

Please first to submit.