Hi,
There are 15 buttons on the screen of my application. Normally only one
button is highlight, for example buttonA. But if I press buttonB for a long
time and/or multi-times it will be highlight too. And the buttonA is still
highlight. So two buttons are highlighted. Use the same way three or four
buttons will be highlighted at same time on the screen. If I use direction
key to move the cursor over all the highlight button then only one button is
highlight.
I use button to change frequency in my program. If pressing button in less
than FIRST_DELAY it only changes frequency one step. It will change one more
step for every CONST_DELAY after FIRST_DELAY. It works fine. The issue is
the highlight when pressing a long time.
I put the program bellow:
private Handler switchHandler = new Handler()
{
@Override
public void handleMessage(Message message)
{
if( MESSAGE_INCREASE_CHANNEL == message.what )
{
//
sendEmptyMessageDelayed( MESSAGE_INCREASE_CHANNEL, CONT_DELAY);
}
}
}
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Button button = (Button)findViewById( R.id.radio_channel_up);
button.setOnTouchListener( new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent event)
{
if( view instanceof Button )
{
if( MotionEvent.ACTION_DOWN == event.getAction() )
{
//
switchHandler.sendEmptyMessageDelayed(
MESSAGE_INCREASE_CHANNEL, FIRST_DELAY);
return true;
}
}
return false;
}
});
}
Thanks,
Shude
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en