Good day all.
new to Android, and I have small app that is working.
I would like to show one portion of the text in a different color.
Here is my function.
//show Medications
fun getAllMeds(): List<Medication> {
val medList = mutableListOf<Medication>()
val db = readableDatabase
val query = "SELECT * FROM $TABLE_NAME"
val cursor = db.rawQuery(query, null)
while (cursor.moveToNext()){
val id = cursor.getInt(cursor.getColumnIndexOrThrow(COLUMN_ID))
val medname = cursor.getString(cursor.getColumnIndexOrThrow(COLUMN_MEDNAME))
val medpill = cursor.getString(cursor.getColumnIndexOrThrow(COLUMN_MEDPILL))
val medtaken = cursor.getString(cursor.getColumnIndexOrThrow(COLUMN_MEDTAKEN))
var text = "Take <font color=Red>(" + medpill + ")</font> pill every "
val med = Medication(id, medname, text, medtaken)
medList.add(med)
}
cursor.close()
db.close()
return medList
}
the portion under text does not change color, just prints the whole line.
if have this appear on main screen in a TextView.
any pointers would be appreciated.
Have a great day!