i trying build scheduling application, , trying tell app distinguish between scrolling , tapping date. when scroll month, setondatechangelistener fired when did not intended to.
so have tried or gathered: tried implementing ongesturelistener (not sure if right way go it) , using onsingletapup method identify between scrolling , selecting date. tried putting setondatechangelistener method onsingletapup method don't make sense since when selecting date, technically trying call setondatechangelistener.
i appreciate kind guidance or referral similar post.
thanks
cliff b
import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.gesturedetector; import android.view.gesturedetector.ondoubletaplistener; import android.view.gesturedetector.ongesturelistener; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.widget.calendarview; import android.widget.calendarview.ondatechangelistener; public class mainactivity extends activity implements ongesturelistener{ //setting variables calendarview calendar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); calendar = (calendarview) findviewbyid(r.id.calendarview1); } @override public boolean ondown(motionevent e) { // todo auto-generated method stub return false; } @override public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) { // todo auto-generated method stub return false; } @override public void onlongpress(motionevent e) { // todo auto-generated method stub } @override public boolean onscroll(motionevent e1, motionevent e2, float distancex, float distancey) { // todo auto-generated method stub return false; } @override public void onshowpress(motionevent e) { // todo auto-generated method stub } @override public boolean onsingletapup(motionevent e) { // todo auto-generated method stub calendar.setondatechangelistener(new ondatechangelistener () { @override public void onselecteddaychange(calendarview view, int year, int month, int dayofmonth) { // todo auto-generated method stub intent intent = new intent(); intent.setclass(mainactivity.this, tasksetup.class); intent.putextra("data", dayofmonth); startactivity(intent); } }); return false; } }
try return true; in onsingletapup method.
thanks.
Comments
Post a Comment