android - ArrayAdapter.createFromResource issue -


i trying make "select one" on spinner. saw answer regarding subject still having issues. usual way of making custom spinner is:

arrayadapter<charsequence> dataadapter1 =  arrayadapter.createfromresource(this, r.array.entries,                                         android.r.layout.simple_spinner_item);         dataadapter1.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);         spinner1.setadapter(dataadapter1);          spinner1.setadapter(                   new nothingselectedspinneradapter(                         dataadapter1,                         r.layout.contact_spinner_row_nothing_selected,                                                     this)); 

in code have define r.array.entries in strings.xml, app populating spinner mysql , having list grad[i]=json.getstring("grad");. how can create arrayadapter.createfromresource list instead of entries defined in strings.xml? tnx

query data, put in list or array , use constructor of array adapter

arrayadapter<charsequence> dataadapter1 =  new arrayadapter(this,                                      android.r.layout.simple_spinner_item, yourarrayorlist); 

more here: http://developer.android.com/reference/android/widget/arrayadapter.html#arrayadapter(android.content.context, int, java.util.list)


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -