【问题标题】:Picture on Google Glass without "Tap" cofirmation谷歌眼镜上的图片没有“胶带”确认
【发布时间】:2015-05-07 07:45:32
【问题描述】:

我正在尝试获取图片,但使用我的代码,需要通过“点击”手势确认图片。

这是我的代码:

private void takePicture() {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(intent, TAKE_PICTURE_REQUEST);
    }

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == TAKE_PICTURE_REQUEST && resultCode == RESULT_OK) {
            String thumbnailPath = data.getStringExtra(Intents.EXTRA_THUMBNAIL_FILE_PATH);
            String picturePath = data.getStringExtra(Intents.EXTRA_PICTURE_FILE_PATH);

            processPictureWhenReady(picturePath);
            // TODO: Show the thumbnail to the user while the full picture is being
            // processed.
        }
        else{
            takePicture();
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

我看过这个帖子:

Is it possible to take a photo using Google Glass without "tap to accept"?

但是没有 Tap 我无法获取图片。 有例子吗?

谢谢!

【问题讨论】:

    标签: android android-camera google-glass


    【解决方案1】:

    为此,您需要添加一种启用手势检测的机制。在您的情况下,它是 TAP 手势。我建议将这段代码放在您的 takePicture() 方法中:

     @Override
        public boolean onKeyDown(int keycode, KeyEvent event) {
            if (keycode == KeyEvent.KEYCODE_DPAD_CENTER) {
                // user tapped touchpad, do something
                return true;
            }
            ...
            return super.onKeyDown(keycode, event);
        }
    

    这将使您只有在点击 Glass 并因此确认时才能拍照。更多详情请查看document

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多