lundi 13 juillet 2015

Deleting from SQLite database in onCreate

In my class, I have this part of code in onCreate method:

if(settingsProvera.contains("false")){
        yourBoolean=true;
    }else{
        yourBoolean=false;
    }
    if(yourBoolean){
        int godina=Calendar.getInstance().get(Calendar.YEAR)+1900;
        int mesec=Calendar.getInstance().get(Calendar.MONTH)-2;
        int dan=Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
        DbReminders bazaDelete=new DbReminders(context);
        bazaDelete.open();
        bazaDelete.deleteReminder("DATUM < '"+godina+"-"+mesec+"-"+dan+" 00:00 AM'");
        bazaDelete.close();
        podsetniciAdapter.notifyDataSetChanged();
    }

The problem is that whenever I start this class it deletes everything from list, no matter if boolean is true or false. Why?

Aucun commentaire:

Enregistrer un commentaire