I am trying to display information from a database in my android app. However, I would like it prefixed with the character €. Is that possible?
My Current code:
String[] from = new String[]{savingDB.KEY_DATE};
int[] to = new int[]{R.id.date};
What I tried:
String[] from = new String[]{"€" + savingDB.KEY_DATE};
int[] to = new int[]{R.id.date};
You’re gonna have to do something custom. There are at least a couple of alternatives. If you’re using a SimpleCursorAdapter the simplest is to just override the
bindView()method and forcefully set the value on the view that you want. You can look at the SimpleCursorAdapter code to get an idea of what you have to do. Boils down to retrieving your column from the Cursor, finding the view you want to set and callingview.setText("$" + stringFromCursor);Alternatively, you can roll your own Cursor and instead of getting just the
savingDB.KEY_DATEcolumn from the database, you query the database using a concatenation, like: `”select ‘€’ || ” + savingDB.KEY_DATE + ” from yourtable”. Something like that.