flashlight

LED Flashlight does not work on Samsung Galaxy Nexus

情到浓时终转凉″ 提交于 2019-11-28 00:22:19
问题 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);

How to turn on flashlight and front camera at the same time in android

半城伤御伤魂 提交于 2019-11-27 07:58:43
问题 In one of the requirement in my app I need to pop up an activity containing the front camera preview,at this same time I need to turn on the flashlight as well.However I observe that,I am able to turn on the flashlight and back camera but not front camera and flashlight together.Following is my code: public class Cam extends Activity { private static int cameraId = 0; private Camera camera; //Adding for camera preview public static FrameLayout preview; public static CameraPreview mPreview;

Turn ON/OFF Camera LED/flash light in Samsung Galaxy Ace 2.2.1 & Galaxy Tab

巧了我就是萌 提交于 2019-11-27 07:39:49
I am turning ON Camera LED light using FLASH_MODE_ON . Samsung Galaxy Ace have only three flash modes : on, off and auto. FLASH_MODE_TORCH not working in Samsung Galaxy Tab & Samsung Galaxy Ace 2.2.1 Here is my code how i am turning ON my Camera LED Camera cam; cam = Camera.open(); Parameters params = cam.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_ON); cam.setParameters(params); cam.startPreview(); cam.autoFocus(new AutoFocusCallback() { public void onAutoFocus(boolean success, Camera camera) { } }); And turning it off by using : cam.stopPreview(); cam.release(); Code Reference

Turn ON / OFF Flashlight using SurfaceView

孤街醉人 提交于 2019-11-27 06:56:00
问题 I am writing an Android Camera App and trying to implement Flash functionality, I am using SurfaceView, whenever i do tap on flash button toggle works but flash not coming... see my below code i have used to Turn ON/OFF Flashlights. Complete code:-- @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); preview=(SurfaceView)findViewById(R.id.surface); previewHolder=preview.getHolder(); previewHolder.addCallback

Android: Keep camera-LED on after screen turns off

时光怂恿深爱的人放手 提交于 2019-11-27 03:32:03
问题 since i'm at the beginning with Android coding i hesitated to post my question, but now i'm at the point where i can't resist. I have a service which turns on the camera-LED onCreate: @Override public void onCreate() { // make sure we don't sleep this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE); this.mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SleepLED"); this.mTimer = new Timer(); this.mTimerTask = new TimerTask() { public void run() { // turn on the LED

Can I change the LED intensity of an Android device?

丶灬走出姿态 提交于 2019-11-26 22:08:14
Is there a way to set the LED intensity that I desire? I know that to turn on the LED I use: p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); mycam.setParameters(p); But this code just turns on the LED. But is there a way to set different intensities to the LED for a stronger light or to reduce the light intensity? HTC has an alternative API that supports this, however it's only on HTC Sense devices, and as of Gingerbread they've changed the permissions so it's only for their Flashlight app, not third party ones (unless you use root). But on 2.2 HTC devices you can use it by writing a

How to turn flashlight ON and OFF in swift?

蹲街弑〆低调 提交于 2019-11-26 15:44:48
问题 I'd like to add flashlight functionality to my app in Swift. How can I go about doing that? 回答1: Update #1: ( torchActive isn't returning the expected value; perhaps because it's been modified) Update #2: For Swift 2.0 To toggle the flash from on to off (not just "on" as in mad pig's answer), you can use the following method: func toggleFlash() { let device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) if (device.hasTorch) { do { try device.lockForConfiguration() if (device

LED flashlight on Galaxy Nexus controllable by what API?

我与影子孤独终老i 提交于 2019-11-26 15:22:10
So many LED flashlight API questions for Android. I'm afraid to ask yet another, but here goes.. Using the tried and true FLASH_MODE_TORCH I am able to achieve satisfaction with my Samsung Galaxy SII and get the LED flash turned on. On my friend's Galaxy Nexus, no such luck. Nor on my other friend's Droid X. I'm noticing for a not insignificant number of devices specific native IOCTL calls seem to be required. Is this the case for the Galaxy Nexus? How do I find a reference to program it? I am doing the standard FLASH_MODE_TORCH/"flash-mode"="torch", startPreview() chain. Kind of disappointing

android java lang runtimeexception fail to connect to camera service

耗尽温柔 提交于 2019-11-26 04:24:25
问题 I am currently working on Flashlight On/OFF. I am getting this error java.lang.RuntimeException: Fail to connect to camera service I don\'t know why this error is occurring. I referred to many solutions but my problem was still not solved. When flashlight is on, the error does not occur but when the flashlight is off then the error occurs. My Code Main Code. My Manifest permission: <uses-permission android:name=\"android.permission.CAMERA\" /> <uses-feature android:name=\"android.hardware

Use camera flashlight in Android

耗尽温柔 提交于 2019-11-26 04:09:53
问题 I\'m trying to use the cameras LED flashlight in a widget. I\'ve found several threads about this topic (i.e. the one mentioned later..) , now I\'m trying to control the light using: Camera cam = Camera.open(); Parameters p = cam.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(p); cam.release(); In the AndroidManifest.xml tried different permissions, currently I have: <uses-permission android:name=\"android.permission.CAMERA\" /> <uses-permission android:name=\