I'm making an app, that is storing some dates in a SQLite db on an android device.
Currently, most of it works as intended, except for parsing the text string that i store the date as.
private final String ALARMS_COLUMN_TIME = "time";
Calendar cal = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String dateString = cursor.getString(cursor.getColumnIndex(ALARMS_COLUMN_TIME));
cal.setTime(dateFormat.parse(dateString));
The problem is that, even before compiling, it gives me a, seemingly syntax error, with the "unhandled exception java.text.ParseException".
the imports i'm using in that class are these:
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
I have tried with various Locales as well, as part of the SimpleDateFormat constructor, but it haven't made any difference.
What can be the cause of this unhandled exception, prior to compiling?
Thanks in advance,
Ronnie