Android程序报错:java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.

时间:2021-09-18 20:50:58

当程序报错:java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference

如图:

Android程序报错:java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.

其实不管是LIstView还是GridView都会可能出现这种报错,原因都是:对应的Adapter的getView方法返回为空,出现的这个空指针现象