I have a ListView which contains a text field that is populated using a SimpleCursorAdapter. In my database, the field is allowed to be null (a desired effect), however, if the value is null, rather then having the TextView be blank (as populated by the SimpleCursorAdapter), I want it to contain some default value, say “——-“. How can I acheive this effect?
It can either be done by the way I run my SQLite query, or by some method telling the textView to ignore “”, and show its android:text value or something like that. Whichever method is recommended, I can’t figure out how to do it. Any help is appreciated.
I would use
ifnullin your SQL SELECT statement as per this answer. Something like:or if you need the column name: