flash torch functionality not working through app-widget in nexus 5

╄→尐↘猪︶ㄣ 提交于 2019-12-05 17:31:38

The camera needs a surface to cling to in order to open the
Flashlight..however SurfaceView cannot be applied to a widget. So this is what you need to.....

Add this to your turnFlashOn code:

try {
mCamera.setPreviewTexture(new SurfaceTexture(0));
} catch (IOException e) {
e.printStackTrace();
}

Also, remove all references to surfaceview in your code as it is not applicable in a widget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!