這是我的code。連接EditText給NullPointer錯誤
我收到以下錯誤的logcat:
09-04 08:32:40.524: E/AndroidRuntime(644): FATAL EXCEPTION: main
09-04 08:32:40.524: E/AndroidRuntime(644): java.lang.NullPointerException
09-04 08:32:40.524: E/AndroidRuntime(644): at com.vodacom.nollyviewer.Searchnolly.SearchVideos(Searchnolly.java:109)
09-04 08:32:40.524: E/AndroidRuntime(644): at com.vodacom.nollyviewer.Searchnolly$1.onClick(Searchnolly.java:71)
09-04 08:32:40.524: E/AndroidRuntime(644): at android.view.View.performClick(View.java:2485)
有什麼建議?
什麼是行號碼的代碼:文件Searchnolly.java的109? –
prolly'findViewById(R.id.resultdisplay);'返回null,因此'resultdisplay'爲null ... – Selvin
將此行放在activity的oncreate()中\t editTextProducer =(EditText)findViewById(R.id.editTextProducer); –