title: Kotlin Android Studio Warning "Do not concatenate text displayed with setText. Use resource string with placeholders."
body: <p>I made a simple program to learn about concatenation in android studio with Kotlin. So, I tried to get a string value from resources in strings.xml as shown below and concatenate with a value</p>
  <pre><code>&lt;string name=&quot;txt_show&quot;&gt;Your lucky number is %1$s&lt;/string&gt;
  </code></pre>
  <p>I got warning &quot;Do not concatenate text...&quot; from getString</p>
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      val firstNumber = numEditText.text
  
      processButton.setOnClickListener {
          val result = concatText(firstNumber.toString().toDouble())
          resultView.text = getString(R.string.txt_show, &quot; &quot;) + result.format(2)
  
      }
  }
  
  private fun concatText(myNumber: Double): Double {
      val luckyNumber = 1.79
      return luckyNumber * myNumber
  }
  private fun Double.format(digits: Int) = java.lang.String.format(&quot;%.${digits}f&quot;, this)} 
  </code></pre>
  <p>By replacing <p></p>
  <pre><code>resultView.text = getString(R.string.txt.show, &quot; &quot;) + result.format(2)
  </code></pre>
  <p>with</p>
  <pre><code>val finalResult =  result.toInt()&lt;p&gt;
  resultView.text = getString(R.string.txt_show, finalResult)&lt;p&gt;
  </code></pre>
  <p>And replace <code>%1$s</code> to <code>%1$d</code> in resources of strings.xml<p></p>
  <p>The warning is gone but I got problems, first the result is integer which is not what I expected. It should be double. Second, adding the function format in getString will stop the program with &quot;Unexpected Error...&quot; message on the screen.</p>
  <p>How can I solve this problem?</p>