I know that emulation of trackball to DPAD do not work so good, then i
decide use trackball.
I override onTrackBallEvent but I have problem .It has good reaction
for action move ... when I track left, it goes left, when I track
right, it goes right, but I can't stop it .When I unpress ..
(action_up) the track ball .. it does nothing... still continue to
move. It does stop moving only when I track up or down....
I have no action_up or action_cancel,down reactions ... only
action_move react.
thread.sprite.moveleft or right ... is moving my sprite untlil a call
sprite.stayStil...
Logically it should be at ACTION_UP .... but it do nothing
Does have somebody experience with trackball reactions? (action up)
@Override
public boolean onTrackballEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
thread.sprite.stayStill();
// trackball selected... ignore
break;
case MotionEvent.ACTION_UP:
thread.sprite.stayStill();
return true;
case MotionEvent.ACTION_CANCEL:
// trackball selected... ignore
thread.sprite.stayStill();
return true;
case MotionEvent.ACTION_MOVE:
if (mContext != null) {
float x = event.getX() * event.getXPrecision();
float y = event.getY() * event.getYPrecision();
thread.xx=(int)x;//for debug, show on screen
if(x<(int)0)thread.sprite.moveLeft();
if(x>(int)0)thread.spritemoveRight();
if(x==(int)0)thread.sprite.stayStill();
x=0;
return true;
}
}
return super.onTrackballEvent(event);
}
Thx for answers.
J
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---