2015-11-06 72 views
0

當我使用的代碼https://github.com/plattysoft/Leonids實現一些effect.sometimes它會發生crash.the消息是:dispatchDraw NullPointerException異常沒有任何有用的錯誤信息

FATAL EXCEPTION: main 
java.lang.NullPointerException 
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2911) 
     at android.view.View.getDisplayList(View.java:12841) 
     at android.view.View.getDisplayList(View.java:12890) 
     at android.view.View.draw(View.java:13640) 
     at android.view.ViewGroup.drawChild(ViewGroup.java:3050) 
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2912) 
     at android.view.View.getDisplayList(View.java:12841) 
     at android.view.View.getDisplayList(View.java:12890) 
     at android.view.View.draw(View.java:13640) 
     at android.view.ViewGroup.drawChild(ViewGroup.java:3050) 
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2912) 
     at android.view.View.getDisplayList(View.java:12841) 
     at android.view.View.getDisplayList(View.java:12890) 
     at android.view.View.draw(View.java:13640) 
     at android.view.ViewGroup.drawChild(ViewGroup.java:3050) 
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2912) 
     at android.view.View.getDisplayList(View.java:12841) 
     at android.view.View.getDisplayList(View.java:12890) 
     at android.view.View.draw(View.java:13640) 
     at android.view.ViewGroup.drawChild(ViewGroup.java:3050) 
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2912) 
     at android.view.View.draw(View.java:13947) 
     at android.widget.FrameLayout.draw(FrameLayout.java:467) 
     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2247) 
     at android.view.View.getDisplayList(View.java:12846) 
     at android.view.View.getDisplayList(View.java:12890) 
     at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1249) 
     at android.view.ViewRootImpl.draw(ViewRootImpl.java:2567) 
     at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434) 
     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2236) 
     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1211) 
     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5039) 
     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776) 
     at android.view.Choreographer.doCallbacks(Choreographer.java:579) 
     at android.view.Choreographer.doFrame(Choreographer.java:548) 
     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762) 
     at android.os.Handler.handleCallback(Handler.java:800) 
     at android.os.Handler.dispatchMessage(Handler.java:100) 
     at android.os.Looper.loop(Looper.java:194) 
     at android.app.ActivityThread.main(ActivityThread.java:5433) 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:525) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689) 
     at dalvik.system.NativeStart.main(Native Method) 

沒有任何有用的message.I即使使用try catch塊如下:

try 
    { 
     configureEmiter(emiter, gravity); 
     startEmiting(particlesPerSecond); 
    }catch (NullPointerException e){ 

    } 
    catch (Exception e){ 

    } 

但它不起作用。 有沒有解決這個問題的想法?請幫助我,非常感謝。

+0

add more logs:java.lang.NullPointerException:嘗試從空對象的字段'int android.view.View.mViewFlags'中讀取參考 E/AndroidRuntime(3733):\t at android.view.ViewGroup.dispatchDraw (ViewGroup.java:3197) – shaotine

+0

PS:我已使用viewpager – shaotine

+0

http://stackoverflow.com/questions/23038131/nullpointerexception-on-dispatchdraw-with-viewpager-in-nested-fragment-with-page檢查此,錯誤與viewpager –

回答

1

我的代碼中有一些錯誤,我刪除了該視圖導致問題。感謝您的關注和答覆。

相關問題