title: How to change text size from OnCreate using code in Kotlin
body: <p>I have an activity which have Spinner and TextView. I want to use the Spinner to change the text size in TextView. there is three size in spinner(small, mediam and large) I put these size in dimen.xml .. how can I use Spinner to Change size?
  I tried this code but it didn't work</p>
  
  <pre><code>val fontSize = arrayOf("large", "medium", "small")
  
      spinner.adapter = ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, fontSize)
      spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener{
          override fun onNothingSelected(parent: AdapterView&lt;*&gt;?) {
          }
  
          override fun onItemSelected(parent: AdapterView&lt;*&gt;?, view: View?, position: Int, id: Long) {
              when(position){
                  0 -&gt; {
                      textView.textSize = R.dimen.font_large.toFloat()
                  }
                  1 -&gt;{
                      textView.textSize = R.dimen.font_medium.toFloat()
                  }
                  2 -&gt;{
                      textView.textSize = R.dimen.font_small.toFloat()
                  }
              }
          }
      }
  </code></pre>