

Spinner fishSpin = (Spinner) findViewById(R.id.spinBass) ĪrrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, fish) ĪtDropDownViewResource(android.R.layout. New View.OnClickListener() void onClick(View v) Now, I'm not 100% sure about HOW to pass the value so I followed how the EditTexts worked and followed that as in the following: Jadi, buka android studio kalian kemudian masukkan beberapa script di bawah. Untuk tutorial yang pertama, kita akan membuat spinner android menggunakan array statis yang berasal dari XML. : Attempt to invoke virtual method ' ()' on a null object referenceĪt $3.onClick(MainActivity.java:96) Cara Membuat Spinner Menggunakan String-array XML.


When I go to add the new record my app crashes and then i get this error below in Android Studio. Android Spinner is just like the combox box or drop down menu of AWT or Swing in java. I've now replaced one of the EditTexts with a Spinner which shows my two values when I test the app. Through a tutorial I made my first MySQL database which uses EditTexts, then can Add, update, delete and view the records.
