I have a problem in developing an App, following, I have a list of all donation data in the database, and in this activity I created a TextView to receive the full value of those donations, however, I have some problems: 1st the value field in the bank saved in TEXT exp: 'R $ 120,00', 'R $ 325,65' and so I make a sum with substr; 2 ° when I try to bring the result of that sum actually in the app it leaves the entire query text, I tried in several ways and this is the current situation of my code:
public String RetornarTotal(){
SQLiteDatabase db = this.getWritableDatabase();
Cursor stmt = db.rawQuery("SELECT SUM(SUBSTR(VALOR,3,20)) FROM " + TABLE_NAME, null);
String total = stmt.getColumnName(0).toString();
//String total = stmt.execute();
return total;
}
This method is called in the oncrete of activity and gets in the SQLHelper class, I want to return only the value of that sum, could you help me?