Yeah sorry this is a month late...
Here is a Class the X and Y will update as your finger moves across
the screen. Forgive the formatting it went all wrong when pasting...
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
int X = (int)event.getX(); // this is the x of your finger
touching the screen
int Y = (int)event.getY(); // this is the y of your finger
touching the screen
switch (eventaction ) {
case MotionEvent.ACTION_DOWN: //you can see this is when first
clicking
break;
case MotionEvent.ACTION_MOVE: //this triggers most the time
because your finger flattens out on the screen causing it to think
your moving...
break;
case MotionEvent.ACTION_UP:
break; //ends the case for action up.
}//ends the switch event
return true;
}// ends the onTouch event.
On Sep 9, 6:50 am, Tomáš Hubálek <[email protected]> wrote:
> Hello,
>
> I have a widget and I would like to detect position where user click
> on some part of the widget's bitmap. I didn't found any way how to
> detect coordinates of the touch on RemoteViews.
>
> Is anybody aware of some trick how to detect it. Only idea I have is
> create layout with grid of transparent buttons, put by widget's bitmap
> as background of such a layout and to every button set PendingIntent.
>
> Any nicer idea?
>
> Thanks
> Tom
>
> http://android.hubalek.net
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en