Sony Smart Watch 2:如何防止按钮长按后调用CLICK_TYPE_SHORT?

时间:2014-03-24 17:28:15

标签: android sony sony-smartwatch

我为Sony SmartWatch 2使用ControlExtension,我有一个点击处理程序:

@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;
    }
}

当我点击按钮时,我按预期在LogCat中获得press
当我按住按钮时,我得到long press(就像我想要的那样) 但是当我在长按后释放按钮时,我再次获得press

如何改变这种行为?

1 个答案:

答案 0 :(得分:0)

您是否尝试过像这样处理长按?

ControlView upperLeft = mLayout.findViewById(R.id.sample_control_object_1);
upperLeft.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public void onLongClick() {
                // handle click action here
            }
        });