错误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.