我将用户的短信收件箱显示为列表视图。我想将 from 和 message 字符串加粗,但由于它们是数组的一部分,所以我无法找出方法。我试过使用strings.xml 中的标签,但这不起作用。如何将这两个字符串设置为粗体?
public ArrayList fetchInbox() {
ArrayList sms = new ArrayList();
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor cursor = getContentResolver().query(uriSms, new String[]{"_id", "address", "date", "body"},null,null,null);
cursor.moveToFirst();
while (cursor.moveToNext())
{
String address = cursor.getString(1);
String body = cursor.getString(3);
sms.add(from + " " + address + "\n" + message + " " + body);
}
return sms;
}
private void setStrings() {
from = (String) getResources().getString(R.string.from);
message = (String) getResources().getString(R.string.message);
}