问题
I use a ControlExtension for Sony SmartWatch 2 and I have a click-handler:
@Override
public void onObjectClick(final ControlObjectClickEvent event) {
switch (event.getClickType())
{
case Control.Intents.CLICK_TYPE_LONG:
Log.i("onObjectClick", "long press");
break;
case Control.Intents.CLICK_TYPE_SHORT:
Log.i("onObjectClick", "press");
break;
}
}
When I click on the button, I get press
in my LogCat as expected.
When I hold the button I get long press
(just as I want it).
But when I release the button after a long-press, I get press
again.
How can I change this behavior?
回答1:
Have you tried handling a long click like this?
ControlView upperLeft = mLayout.findViewById(R.id.sample_control_object_1);
upperLeft.setOnLongClickListener(new OnLongClickListener() {
@Override
public void onLongClick() {
// handle click action here
}
});
来源:https://stackoverflow.com/questions/22616429/sony-smart-watch-2-how-to-prevent-click-type-short-from-being-called-after-butt