Thanks guys. Yes now it works. Had to use event.getAction and draw
method.
package <>.DrawPoints;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.ut
Here is another bug in the code:
if(i == 0) {
static_x = event.getX();
static_y = event.getY();
i = 1;
} else
{
static_x1 = event.getX();
static_y1 = event.getY();
On Mon, Apr 13, 2009 at 5:12 PM, gandor wrote:
>
> Hi Folks,
>
> Want to draw a line when I touch screen at two points.
> I can see OnTouch been invoked but after than everything breaks looks,
> the application crashes
>
> I am using drawLine in Canvas.
> Please let me know what I am doing wrong
You aren't limiting this to ACTION_DOWN and/or ACTION_UP so on every
ACTION_MOVE, you are running this code. Probably the reason it
crashes. I'd do this:
@Override
public boolean onTouch(View v, MotionEvent event)
{
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
4 matches
Mail list logo