I have a value from the other activity that I want to haul as the new value of my layout text:
val txt:String = intent.getStringExtra("resultval").toString()
The XML part looks like this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id = "@+id/prNumberId"
android:text = "PR Number"
android:textColor="@color/black"
android:textSize = "20sp"
android:textStyle = "bold"/>
Now, I want to change the text “PR Number” into something like “PR7438927438927”. How would I do that? Using this:
findViewById<Text>(R.id.prNumberId).replaceWholeText(txt)
or using:
findViewById<Text>(R.id.prNumberId).textContent = txt
throws me an error saying: Type Argument is not within its bounds.
How can I assign the value of the prNumberId with the new variable I have?
Thank you.
I tried changing the values through the findByViewId and textContent but it doesn’t work as it says there is a type argument not within its bounds. It does not accept the R.id.prNumberId as Text.