Spinner spinFak;
String[]pilFak={"Kedokteran","Ekonomi dan Bisnis","Hukum","Kedokteran Gigi","Teknik","Ilmu Peng. Budaya","Psikologi","Kesehatan Masy.","Matematika dan IPA","Ilmu Sosial dan Politik"," Ilmu Komputer","Ilmu Keperawatan","Farmasi","Ilmu Adminstrasi","Program Vokasi","Sekolah KSG","Sekolah Ilmu Lingkungan","UI"};
spinFak= (Spinner) findViewById(R.id.spinFak);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, pilFak);
spinFak.setAdapter(adapter);
String fak=myJSON.getString(TAG_fakultas);
int ba=getBaris(pilFak,fak);
spinFak.setSelection(ba);
int getBaris(String[]ar,String item){
int index=0;
int jba=ar.length;
for(int h=0;h<jba;h++){
if(item.equalsIgnoreCase(ar[h])){
index=h;
break;
}
}
return index;
}
+++++++++++++++++++++++++++++++++++++++++++
Tidak ada komentar:
Posting Komentar