-4
的NullPointerException - LinearLayout.getChildCount()
错误:
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.LinearLayout.getChildCount()' on a null object reference
的NullPointerException - LinearLayout.getChildCount()
错误:
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.LinearLayout.getChildCount()' on a null object reference
你的LinearLayout变量为空,所以你不能在它调用getChildCount()
。请确保初始化您的变量或通过findViewById
获取它。
很明显,你在编程方面非常新手,并且专注于一个非常具体的问题。在我看来,通过代码中的各种问题,您可能希望退后一步,并首先提高对Java和Java编程的理解。 –
你没有在第一行之前显示代码......抛出异常的代码。添加请显示文字,而不是图片 –