java - setOnDateChangeListener() of CalenderView -
i working calendar project in android studio. when click on date opens new activity.the problem if date selected ( when open calendar can see current date selected ), when click on it, gives me no response. how can change this. not problem me when testing application in android virtual device when installed application in phone problem occurred.
check photo have given, date selected not give response when testing on avd , if clicked on selected date gave me response.
here code method, works this, first check if there event saved on date selected. if yes open alert box showing event otherwise open activity can save event
calendarview.setondatechangelistener(new calendarview.ondatechangelistener() { @override public void onselecteddaychange(@nonnull calendarview calendarview, int i, int i1, int i2) { date = i2 + "" + i1 + "" + i; date = integer.parseint(date); log.e(tag,"int date="+date+""); log.e(tag,"string date="+date+""); //firstly check if entry exists current date. cursor res = mydb.getalldata(); while(res.movetonext()) { if (res.getint(0) == date) { //only runs if find id date. stringbuffer buffer = new stringbuffer(); buffer.append("id :" + res.getstring(0) + "\n"); buffer.append("event name :" + res.getstring(1) + "\n"); buffer.append("event location :" + res.getstring(2) + "\n"); buffer.append("event discription :" + res.getstring(3) + "\n\n"); //when id present event, there must entry attendees, search date(id) attendees. cursor cursor = mydb2.getalldata(); while(cursor.movetonext()) { string test=cursor.getint(0)+""; if (test.contains(date)) { log.e(tag,"it reached here"); buffer.append("event attendee :" + cursor.getstring(1) + "\n\n"); } } // show message showmessage("data", buffer.tostring()); return; } } //if no entry found pass id date , shift activity_date_selected activity ). intent = new intent(mainactivity.this, dateselected.class); intent.putextra("date message", date); intent.putextra("day message", i2); intent.putextra("month message", i1); intent.putextra("year message", i); startactivity(intent); } }); } please not down vote question. new stackoverflow , programming. kind of useful.

Comments
Post a Comment