I have a custom video player that uses a SurfaceView inside a fragment.
public void surfaceCreated(SurfaceHolder surfaceholder) {
if(null==m_strVideoPath)
return;
LogUtil.e(TAG, "initiating player now..");
initPlayer(m_strVideoPath);
playVideo(m_strVideoPath);
}
I see a lot of crashes in the store with the nullpointer exception in the SurfaceView updateWindow method. Here are the alarm logs:
java.lang.NullPointerException
at android.view.SurfaceView.updateWindow(SurfaceView.java:603)
at android.view.SurfaceView.access$000(SurfaceView.java:86)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1909)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1038)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5651)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5034)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:805)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:621)
at dalvik.system.NativeStart.main(Native Method)
A look at the source code for the SurfaceView class on line 603 gives me:
if (redrawNeeded) {
602 if (DEBUG) Log.i(TAG, "finishedDrawing");
603 mSession.finishDrawing(mWindow);
604 }
I could not reproduce this failure on any of my test devices, wondering if anyone could help in understanding this scenario. Thanks in advance.
source
share