LED手电筒不会对三星Galaxy Nexus的工作 [英] LED Flashlight does not work on Samsung Galaxy Nexus

查看:116
本文介绍了LED手电筒不会对三星Galaxy Nexus的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题: 我的手电筒的应用程序工作正常,在我的三星Galaxy S2,但遗憾的是没有对三星GALAXY Nexus(问题:手电筒忽略按钮 - 点击 - >无反应,没有光,没有崩溃,也不例外)。我读过LED手电筒Galaxy Nexus的控制由什么API?这里的计算器,但它并没有帮助我,因为我的问题仍然occures。 这是我的code-片段来控制光:

I've got the following problem: My Flashlight app works fine on my Samsung Galaxy S2 but unfortunately not on the Samsung Galaxy Nexus (problem: flashlight ignores the button-click -> no reaction, no light, no crash, no exception). I've read "LED flashlight on Galaxy Nexus controllable by what API?" here in stackoverflow but it did not help me since my problem still occures. This is my code-snippet to control the light:

final Button FlashLightControl = (Button)findViewById(R.id.ledbutton);
FlashLightControl.setOnClickListener(new Button.OnClickListener()
{
        public void onClick(View arg) 
        {
            if(camera != null)
            {
                //in case light is on we will turn it off
                parameters = camera.getParameters();
                parameters.setFlashMode(Parameters.FLASH_MODE_OFF);
                camera.setParameters(parameters);
                camera.stopPreview();
                camera.release();
                camera = null;
            }
            else
            {
                // light is off - we turn it on
                camera = Camera.open();
                parameters = camera.getParameters();
                parameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
                camera.setParameters(parameters);
                camera.startPreview();
            }
        }}); 

任何想法?出于完整性的 - 这些是我加入的Andr​​oidManifest.xml权限:

Any ideas? For the sake of completeness - these are the permissions I added to the Androidmanifest.xml:

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

有人能帮助?

Can someone help?

亲切的问候, CarpeTemporem

Kind regards, CarpeTemporem

推荐答案

我有同样的问题,并通过使用具有1像素的宽度和高度1px的表面观解决了这个问题。

I had the same problem and solved it via using Surface View having 1px width and 1px height

这篇关于LED手电筒不会对三星Galaxy Nexus的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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