I have array that populate its item from JSON using this method
JSONObject dataProvinsi = new JSONObject(data.getString("data"));
ArrayList<CharSequence> arrKota = new ArrayList<>();
JSONArray jsArrKota = dataProvinsi.getJSONArray("kota");
if(jsArrKota.length() > 0) {
for (int i = 0; i < jsArrKota.length(); i++) {
arrKota.add(jsArrKota.get(i).toString());
}
}
Then my spinner populate its item from those array. This is my code to populate spinner item
ProvinsiAdapter provinsiAdapter = new ProvinsiAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrKota);
spRujukanKota.setAdapter(provinsiAdapter);
I created my own adapter class
public class ProvinsiAdapter extends ArrayAdapter<CharSequence> {
private final Context context;
private final ArrayList<CharSequence> itemsArrayList;
public ProvinsiAdapter(Context context,int resource, ArrayList<CharSequence> itemsArrayList) {
super(context, android.R.layout.simple_spinner_item, itemsArrayList);
this.context = context;
this.setDropDownViewResource(resource);
this.itemsArrayList = itemsArrayList;
}
}
My spinner works well, but there is some problem I am facing. My spinner text goes white and I can't change its color into black. My question is, how I can change spinner text color? Any help would be appreciated. Thank you.