android - Spinner onClick items -
i have created spinner.could place spinner items in table java file , call (maybe position) in 1 onclick method?
code:
spinner spinner = (spinner) findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter = arrayadapter.createfromresource( this, r.array.epilogis, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner.setadapter(adapter);
here m getting spinner items string.xml..
i think looking for:
array_spinner=new string[5]; array_spinner[0]="1"; array_spinner[1]="2"; array_spinner[2]="3"; array_spinner[3]="4"; array_spinner[4]="5"; spinner s = (spinner) findviewbyid(r.id.spinner); arrayadapter adapter = new arrayadapter(this,android.r.layout.simple_spinner_item, array_spinner); s.setadapter(adapter);
Comments
Post a Comment