Spinner not showing selected item in android
android
Solution
When adding item dynamically to the adapter, if not calling the:
adapter.notifyDataSetChanged();
selecting an added item would not be shown in the UI.
Problem
I'm using Spinner in my Application, while resuming from another screen, it is displaying the first item in it, but the old item is selected. I'm using the following code, Any one please help me. ``` Spinner= (Spinner) findViewById(R.id.spinner1); dataAdapter=null; dataAdapter = new ArrayAdapter<String>(this,android. R.layout.simple_spinner_item, country); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner.setAdapter(dataAdapter); if (myPrefs.getBoolean("isChecked", false)) { Spinner.setSelection(myPrefs.getInt("PreviouslyselectedID", 0)); } else { country.add(0, "Please Select"); } ``` Thanks in advance..