The problem is that I can not load in the database String expression from "00" to "09". Displays either 0 or 9. Here is the actual database creation code and the method of adding to it:
@Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE ALARMCLOCK (" + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + "HOURS TEXT, " + "MINUTES TEXT, " + "DAYS TEXT);"); } public static void insertAlarmCLock(SQLiteDatabase db, String hours, String minutes, String days){ ContentValues contentValues = new ContentValues(); contentValues.put("HOURS", hours); contentValues.put("MINUTES", minutes); contentValues.put("DAYS", days); db.insert("ALARMCLOCK", null, contentValues); } the addition itself:
if(hours.getText().toString().isEmpty()){ h = "00"; } else { h = hours.getText().toString(); } if(minutes.getText().toString().isEmpty()){ min = "00"; } else { min = minutes.getText().toString(); } days = buffer.toString(); AlarmClockDB.insertAlarmClock(db, h, min, days); loading from DB:
cursor = db.query("ALARMCLOCK", null, null, null, null, null, null); String[] from = new String[]{"HOURS", "MINUTES", "DAYS"}; int[] to = new int[]{R.id.hours, R.id.minutes, R.id.days}; adapter = new SimpleCursorAdapter(this, R.layout.list_item_layout, cursor, from, to, 0); listView.setAdapter(adapter);
int[] to = new int[]{R.id.hours, R.id.minutes, R.id.days};Integer , uniquely now your to without the second zeros will remain. - nick_n_a pm