单击Android Camera Capture按钮

时间:2015-05-19 07:24:07

标签: android bluetooth android-camera bluetooth-lowenergy android-broadcast

我正在为蓝牙设备开发一个应用程序,我必须在蓝牙按钮上点击图片。

我已为BLE设备的接收器编码,我在接收器中获得按钮点击事件,但主要问题是捕获图像代码不起作用。

我已尝试在接收器中使用以下代码

Intent intent1 = new Intent("android.intent.action.CAMERA_BUTTON");
intent1.putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(0, KeyEvent.KEYCODE_CAMERA));
sendOrderedBroadcast(intent1, null);
intent1 = new Intent("android.intent.action.CAMERA_BUTTON");
intent1.putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(1, KeyEvent.KEYCODE_CAMERA));
sendOrderedBroadcast(intent1, null);

我也尝试将KEYCODE_CAMERA更改为KEYCODE_VOLUME_UP,但这也不起作用。

我需要编码才能获得摄像头捕获按钮事件?

2 个答案:

答案 0 :(得分:0)

参考official documentation开发相机应用程序。

请参阅建议使用Camera.takePicture()方法捕获图像的子Capturing pictures

答案 1 :(得分:0)

你应该尝试这样做。

<form:input name="uploadBanner" type="file" id="uploadBanner" path="bannerImage"/> to 
<input name="uploadBanner" type="file" id="uploadBanner" path="bannerImage"/> 

或您可以参考http://www.androidhive.info/2013/09/android-working-with-camera-api/

相关问题