I want to set symbol * at mandatory field. for that i can use below code line:
hint_mobile!!.setText(Html.fromHtml(resources.getString(R.string.mobile_number) + "<sup> * </sup>"));
it is work but i can't set the red color at this symbol *
So i use another example like below :
hint_mobile!!.setText(resources.getString(R.string.mobile_number))
val str = hint_mobile!!.text.toString()
val loc = hint_mobile!!.text.toString().indexOf("*")
str!!.setSpan(ForegroundColorSpan(Color.RED), loc, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
All code set grate but error come on below line:
str!!.setSpan(ForegroundColorSpan(Color.RED), loc, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
ERROR
Unresolved reference: setSpan
So How to i resolve this error ??