快速导航

Android开发中遇到的一些错误

Android 2017/02/18 11:02

错误1:尝试在空对象上调用虚拟方法“void android.widget.LinearLayout.addView(android.view.View)”

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference

解决思路:

查看一下上级的组件findViewById()内的值是否正确

错误2:

android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

Powered by codetiler.com