-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編程的理解。 –
你沒有在第一行之前顯示代碼......拋出異常的代碼。添加請顯示文字,而不是圖片 –