title: Changing text size of an Android Spinner dynamically at runtime
body: <p>I am trying to set the text size of a spinner dynamically in the program. I am using the below code. The text size changes but due to some reason, the spinner always shows the item at index 0 even though the database has a different value and I am using setSelection method to update the selection based on the database. Below is my code. Am I doing something wrong?</p>
  
  <pre><code>    mAutoBackup = (Spinner) findViewById(R.id.auto_backup);
      final CharSequence [] autoBackupValues = getResources().getStringArray(R.array.auto_backup_options); 
      // Create an ArrayAdapter using the string array and a default spinner layout
      ArrayAdapter&lt;CharSequence&gt; adapter = new ArrayAdapter&lt;CharSequence&gt;(this,
              R.layout.spinner_header, autoBackupValues){
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              View v = super.getView(position, convertView, parent);
              if (v instanceof TextView)
                  ((TextView) v).setTextSize(TypedValue.COMPLEX_UNIT_PX, normalTextSize);
              return v;
          }
          @Override
          public View getDropDownView(int position, View convertView,
                  ViewGroup parent) {
              View v = super.getDropDownView(position, convertView, parent);
              if (v instanceof TextView)
                  ((TextView) v).setTextSize(TypedValue.COMPLEX_UNIT_PX, normalTextSize);
              return v;
          }
      };
      // Specify the layout to use when the list of choices appears
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      // Apply the adapter to the spinner
      mAutoBackup.setAdapter(adapter);
  
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/spinner_header"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:gravity="left"
     android:textSize="22sp"
     android:textColor="@android:color/black" &gt;
  &lt;/TextView&gt;
  </code></pre>