CalendarView today date item click

前端 未结 8 1167
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 10:49

I searched a lot on the internet and I couldn\'t succeed to find correct solution for CalendarView click on today date.

8条回答
  •  醉话见心
    2021-01-18 11:08

    Try this:

    CalendarView calendarView=(CalendarView) findViewById(R.id.calendarView1);
    calendarView.setOnClickListener(new OnClickListener() {
    
        @Override
        public void onClick(View v) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTimeInMillis(getDate());
            Intent k = new Intent(GlavnaAktivnost.this, DatumDetalji.class);
            k.putExtra("godina", calendar.get(Calendar.YEAR);
            k.putExtra("mesec", calendar.get(Calendar.MONTH);
            k.putExtra("dan", calendar.get(Calendar.DAY_OF_MONTH);
            startActivity(k);
    
        }
    });
    

提交回复
热议问题