Application Purpose:
A simple application that draws a circle for each touch that is recognized on the screen and follows touch events. With the "high pressure reading" the getPressure (int pointerIndex)color of the circle will change and the radius will increase. In addition, a touch identifier with getPointerId (int pointerIndex)x- and y-coordinates and pressure is displayed next to the touch of a finger .
Following the snipplet code of the important part (please forgive me, this is not the most pleasant code;) I know)
protected void onDraw(Canvas canvas){
if(iTouchAction == (MotionEvent.ACTION_MOVE)){
int x,y;
float pressure;
for (int i = 0; i < touchEvent.getPointerCount(); i++){
x = (int)touchEvent.getX(i);
y = (int)touchEvent.getY(i);
pressure = touchEvent.getPressure(i);
if (pressure > 0.25){
canvas.drawCircle(x, y, z+30, pressureColor);
canvas.drawText(""+touchEvent.getPointerId(i)+" | "+x+"/"+y, x+90, y-80, touchColor);
canvas.drawText(""+pressure, x+90, y-55, pressureColor);
}else{
canvas.drawCircle(x, y, z, touchColor);
canvas.drawText(""+touchEvent.getPointerId(i)+" | "+x+"/"+y, x+60, y-50, touchColor);
canvas.drawText(""+pressure, x+60, y-25, pressureColor);
}
}
}
}
Problem:
HTC Desire Android 2.1 - . . , , - , "" x y. . , getPressure (int pointerIndex) PointerID, .
, : http://www.youtube.com/watch?v=bFxjFexrclU
:
/ (, , ).