![]() Step 3 : Add in implements AdapterView.OnItemSelectedListener to listen the spinner selected value. ![]() Spinner spinner = (Spinner) findViewById(R.id.spinner) List list = new ArrayList() list.add("student A") list.add("student B") list.add("student C") ArrayAdapter dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, list) tDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) tOnItemSelectedListener(this) tAdapter(dataAdapter) Set spinner “setOnItemSelectedListener” to get selected value. Declare Spinner and find id from the activity_main.xml. Create a new ArrayAdapter and assigned the “List”. List String for “studentList” consist of studentA, studentB, studentC. Step 1 : layout have to create a Spinner with id “spinner”.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |