我是靠谱客的博主 兴奋秀发,最近开发中收集的这篇文章主要介绍Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

在做动画是碰到这个错误,后面发现是我在加动画图片这边也在移除动画,

10-09 15:07:15.400: E/AndroidRuntime(10878): FATAL EXCEPTION: main
10-09 15:07:15.400: E/AndroidRuntime(10878): Process: com.geometry, PID: 10878
10-09 15:07:15.400: E/AndroidRuntime(10878): java.lang.NullPointerException: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.updateDisplayListIfDirty(View.java:14056)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.getDisplayList(View.java:14084)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.updateDisplayListIfDirty(View.java:14021)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.getDisplayList(View.java:14084)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.updateDisplayListIfDirty(View.java:14021)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.getDisplayList(View.java:14084)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.updateDisplayListIfDirty(View.java:14021)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.View.getDisplayList(View.java:14084)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:266)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:272)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:311)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2550)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2388)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2019)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1075)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5853)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.Choreographer.doFrame(Choreographer.java:550)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.os.Handler.handleCallback(Handler.java:739)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.os.Handler.dispatchMessage(Handler.java:95)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.os.Looper.loop(Looper.java:135)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at android.app.ActivityThread.main(ActivityThread.java:5336)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at java.lang.reflect.Method.invoke(Native Method)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at java.lang.reflect.Method.invoke(Method.java:372)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
10-09 15:07:15.400: E/AndroidRuntime(10878):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
解决办法


new Handler().post(new Runnable() {
public void run() {
parent.removeView(imageView);
}
});

最后

以上就是兴奋秀发为你收集整理的Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference的全部内容,希望文章能够帮你解决Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部