android - set selection of a Spinner (that uses SpinnerAdapter) programaticaly.? -
I am using spinner editor for my spinner, but I do not know how to set the selection in the code. Those who are not aware are not using the spinner adapters, so there was not much solution for my solution
Here is my adapter:
Private Class PackPricesAdapter BaseAdapter Expands SpinnerAdapter {@Override public int getCount () {refiner spinnerPackices.size (); } @OverWide Public Object Getitam (return status) {Return Spinner Practices.Jet (status); } @ Override Public Long ITMID (Status of Intake) {Return Status; } @ Override public view getView (int position, view view, viewgroup parent) {TextView text = new text view (mContext); Text.setText (spinnerPackPrices.get (status)); Text.setTextSize (13F); Return text; }}
I want to know how I can set a selection program
After setting up the adapter on your spinner
, just call:
spinner.setSelection (position);
Where position
is a 0-based position of the spinner item that you want to choose.
Comments
Post a Comment