I want to disable the next day but not the previous day. I have found out how to disable it for the next day, but for the previous day it was also disabled. Please help me
This is my code
public class Kegiatan extends AppCompatActivity {
private CalendarView calendarKegiatan;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_kegiatan);
calendarKegiatan = (CalendarView) findViewById(R.id.calendarKegiatan);
calendarKegiatan.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
@Override
public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int day) {
Date getdate = Calendar.getInstance().getTime();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/M/d");
String dateNow = dateFormat.format(getdate);
String date = year + "/" + (month + 1) + "/" + day;
if (date.equals(dateNow)) {
Intent intent = new Intent(Kegiatan.this, ListKegiatan.class);
intent.putExtra("tanggal", date);
startActivity(intent);
} else {
Toast.makeText(Kegiatan.this, "Dilarang laporan di hari selanjutnya", Toast.LENGTH_SHORT).show();
}
}
});
calendarKegiatan.setFocusedMonthDateColor(Color.GREEN);
}
}