Spinner spinner = findViewById(R.id.spinner); // get reference to spinner view ArrayAdapterIn this example, we first get a reference to the Spinner view. Then, we create an ArrayAdapter with an array of Strings containing the options we want to display in the spinner. We set the adapter to the spinner using the setAdapter method. Finally, we set the third item in the list to be selected using the setSelection method. Package library: android.widget.adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, new String[]{"Option 1", "Option 2", "Option 3"}); // create an adapter with the data spinner.setAdapter(adapter); // set the adapter to the spinner spinner.setSelection(2); // set the third item as selected