I have one android application that retus a string value form a table using cursor (so only string i think) and when i try to parse int, I get catch exception so i can't increment it, all i need is for it to go form 0 to 1,2,3,5,100,923021312 etc. one every time this is called.
If someone knows were I am wrong how to make it to int or how to get it out of the database directly as int
public String dmst(String id_math)
{
String kleidi="";
int efedriko=0;
String parousies_max="0";
final String SQL_code = "SELECT "+DatabaseHelper.Col_PAROUSIES_MAX+" FROM "+DatabaseHelper.TABLE_NAME2+" WHERE "+DatabaseHelper.Col_ID_MATHIMA+" = "+id_math;
SQLiteDatabase sqLiteDatabase=this.getReadableDatabase();
Cursor cursor = sqLiteDatabase.rawQuery(SQL_code,null);
if (cursor.moveToFirst()) {
do {
parousies_max = cursor.getString(cursor.getColumnIndex("PAROUSIES_MAX"));
}while (cursor.moveToNext());
}
cursor.close();
try {
efedriko = Integer.parseInt(parousies_max);
} catch(NumberFormatException nfe) {}
efedriko=efedriko+1;
