I need the editor to update the information. But, apparently, the editor itself only works 1 time. Even if I clean the editor from any information in another class, it is still not updated
private Runnable runnable = new Runnable() { @Override public void run() { Calendar x = Calendar.getInstance(); int y = x.get(Calendar.YEAR); int m = x.get(Calendar.MONTH) + 1; int d = x.get(Calendar.DAY_OF_MONTH); int h = x.get(Calendar.HOUR_OF_DAY); int min = x.get(Calendar.MINUTE); int s = x.get(Calendar.SECOND); db.open(); cursor = db.getAllData(); if (cursor.moveToFirst()) { do { String name = cursor.getString(cursor.getColumnIndex("txt")); int d110 = cursor.getInt(cursor.getColumnIndex("day")); int m110 = cursor.getInt(cursor.getColumnIndex("month")); int y110 = cursor.getInt(cursor.getColumnIndex("year")); int h120 = cursor.getInt(cursor.getColumnIndex("hour")); int min120 = cursor.getInt(cursor.getColumnIndex("minute")); if (d110 == d && m110 == m && h120 == h && min120 == min) { i = y - y110; SharedPreferences ui; ui = getSharedPreferences("Q", Context.MODE_PRIVATE); final SharedPreferences.Editor editor = ui.edit(); editor.putInt("age",i); editor.putString("name",name); editor.commit(); not(); } } while (cursor.moveToNext());//takes next item cursor.close(); handler.postDelayed(this, 30000); } };