Hello, I am programming an android application and my "testing" device is a Motorola Milestone (Droid). I have done a grid that scroll like the iPhone home menu ( with "points"). I got two problems:
- The first one : the drag only works on the Android Device Emulator and don't on the Droid! (Maybe the multi-touch screen is a problem?)
- The drag is too responsible, and flip views sometimes one by one (this is ok) and sometimes 2 by 2 or 3 by 3! That is clearly problematic!
Here is the code of my OnTouch method:
public boolean onTouch(View v, MotionEvent event) {
if (v instanceof GridView){
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_MOVE:
if (event.getEdgeFlags()==MotionEvent.EDGE_LEFT){
vf2.setInAnimation(this, R.anim.slide_left);
vf2.setOutAnimation(this, R.anim.slide_right);
vf2.showNext();
if (numCurrentPage==2){
numCurrentPage= 0;
} else {
numCurrentPage++;
}
notifyPageNumber(numCurrentPage);
}
if (event.getEdgeFlags()==MotionEvent.EDGE_RIGHT){
vf2.setInAnimation(this, R.anim.slide_in);
vf2.setOutAnimation(this, R.anim.slide_out);
vf2.showPrevious();
if (numCurrentPage==0){
numCurrentPage= 2;
} else {
numCurrentPage--;
}
notifyPageNumber(numCurrentPage);
}
break;
default:
break;
}
}
return false;
}
Thanks for your help!
Update : It doesn't work anymore on the Google Nexus One!