无法使用手电筒在Galaxy Nexus的 [英] Unable to use the flashlight in Galaxy Nexus

查看:86
本文介绍了无法使用手电筒在Galaxy Nexus的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要下code,我只是想在我的Galaxy Nexus的(4.0.2)打开手电筒,它没有这样做。

I have to following code and I just want to open the flashlight in my Galaxy Nexus(4.0.2) and it failed to do so.

public class welcome extends Activity {

//MediaPlayer player;
/** Called when the activity is first created. */
@Override

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.welcome);

    Camera cam = Camera.open();     
    Parameters p = cam.getParameters();
    p.setFlashMode(Parameters.FLASH_MODE_TORCH);
    cam.setParameters(p);
    cam.startPreview();



}
}

我的清单文件:

My Manifest file:

<uses-sdk android:minSdkVersion="12" />
       <uses-permission android:name="android.permission.CAMERA" />
 <uses-feature android:name="android.hardware.camera" />

我想问一下,如果它是我的编码错误或Android版本的问题? 谢谢

I would like to ask if it is my coding error or android version problem? Thanks

推荐答案

在Galaxy Nexus的是无法使用闪光灯,而无需附加surfaceView和surfaceHolder。我有一台Nexus自己,并附加了$ P $后PVIEW,查看它的工作。既然你不想看到摄像头看到了一个手电筒的应用程序是什么,只是让1x1像素。

The galaxy nexus is unable to use the flash without having an attached surfaceView and surfaceHolder. I have a Nexus myself, and after attaching the preview-view it worked. Since you dont want to see what the camera sees in a flashlight app, just make it 1x1 pixel.

来源:<一href="http://stackoverflow.com/questions/9505945/led-flashlight-does-not-work-on-samsung-galaxy-nexus">LED手电筒不会对三星Galaxy Nexus的

这篇关于无法使用手电筒在Galaxy Nexus的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆