I want to run an activity just once in a day. I found this way to do so:
Calendar calendar = Calendar.getInstance();
int currentday = calendar.get(Calendar.DAY_OF_MONTH);
Log.d("Today",""+currentday);
SharedPreferences settings = getSharedPreferences("DAY", 0);
int lastday = settings.getInt("day", 0);
Log.d("Last day",""+lastday);
if(lastday==currentday){Toast.makeText(MainActivity.this,"Activity will run just once a day",Toast.LENGTH_SHORT).show();}
}
Say the value of currentday is 20, How does lastday get it's value from settings.getInt() ?