I'm working on a modified version of the Android Notepad tutorial. The following code is from the fillData function which basically displays the titles of all the notes on a table screen, slightly modified:
Cursor notesCursor = mDbHelper.fetchAllNotes();
startManagingCursor(notesCursor);
String[] from = new String[]{NotesDbAdapter.KEY_TITLE, NotesDbAdapter.KEY_SPECIAL};
int[] to = new int[]{R.id.text1, R.id.text2};
SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.notes_row, notesCursor, from, to);
setListAdapter(notes);
The notes_row.xml
file, is very simple:
<TextView
android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
How can I add @+id/text1
to this XML file so that when the KEY_SPECIAL
field is set to true (or 1), the TextView is bolded? What if I want to use CheckedTextView and get the checkmark instead of bold? How do I write the XML file to look for that input to determine if it's checked originally?