[android-developers] Re: using touch screen to draw a straight line

2009-04-14 Thread gandor
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

[android-developers] Re: using touch screen to draw a straight line

2009-04-14 Thread Per Sandström
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();

[android-developers] Re: using touch screen to draw a straight line

2009-04-14 Thread Marco Nelissen
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

[android-developers] Re: using touch screen to draw a straight line

2009-04-13 Thread nEx.Software
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: