Re: [android-developers] FLASH_MODE_TORCH doesn?t work in Samsung Galaxy Ace

2012-09-23 Thread Barragan
I haven´t tryed if torch mode is supported, but for example, the aplication 
Tiny flashlight works in Samsung Galaxy Ace, and i don´t know the reason...
I guess that i will have use other mode to use FLASH_MODE_TORCH, but i 
don´t know...

El domingo, 23 de septiembre de 2012 15:58:05 UTC+2, Spooky escribió:
>
> On Sat, Sep 22, 2012 at 10:18:48AM -0700, Barragan wrote: 
> > 
> > Here my question: 
> > I?m doing a flash light aplication, and my aplication works in all 
> devices 
> > with flash, but it doesn?t work in some Samsung devices, how Samsung 
> Galaxy 
> > Ace. 
> > I searched in Internet but i don?t find anything... and maybe help me 
> here. 
>
> Did you check to see if torch mode is SUPPORTED by its camera device? 
> See getSupportedFlashModes() in Camera.Parameters 
> (
> http://developer.android.com/reference/android/hardware/Camera.Parameters.html)
>  
>
> for more information. 
>
> You should ALWAYS check to see if a camera parameter you're trying to set 
> is supported for that device BEFORE you try and set it, or you might 
> cause a force close with the camera open, which in most Androids will[1] 
> lock the camera until the user reboots their Android, which, in turn, can 
> lead to a whole lot of p*ssed off users, 1-star ratings, etc. 
>
> Later, 
>--jim 
>
> [1] While my Acer Iconia A500 tablet was still running Honeycomb, if I 
> had an uncaught exception in my camera app (which is now on-hold 
> until the election in November, after which, it may be pointless to 
> release it at all), a force close would NOT lock the camera.  Once 
> it upgraded to ICS, that changed, and it DOES get locked up now.  So 
> I know it doesn't always happen, but you can bet that it will on most 
> Androids. 
>
> -- 
> THE SCORE:  ME:  2  CANCER:  0 
> 73 DE N5IAL (/4)MiSTie #49997  < Running Mac OS X Lion > 
> spook...@gmail.com ICBM/Hurr.: 30.44406N 
> 86.59909W 
>
>  No, I'm not going to explain it.  If you can't figure it 
>  out, you didn't want to know anyway...  --Larry Wall 
>
> Android Apps Listing at http://www.jstrack.org/barcodes.html 
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] FLASH_MODE_TORCH doesn?t work in Samsung Galaxy Ace

2012-09-23 Thread Jim Graham
On Sat, Sep 22, 2012 at 10:18:48AM -0700, Barragan wrote:
> 
> Here my question:
> I?m doing a flash light aplication, and my aplication works in all devices 
> with flash, but it doesn?t work in some Samsung devices, how Samsung Galaxy 
> Ace.
> I searched in Internet but i don?t find anything... and maybe help me here.

Did you check to see if torch mode is SUPPORTED by its camera device?
See getSupportedFlashModes() in Camera.Parameters
(http://developer.android.com/reference/android/hardware/Camera.Parameters.html)
for more information.

You should ALWAYS check to see if a camera parameter you're trying to set
is supported for that device BEFORE you try and set it, or you might
cause a force close with the camera open, which in most Androids will[1]
lock the camera until the user reboots their Android, which, in turn, can
lead to a whole lot of p*ssed off users, 1-star ratings, etc.

Later,
   --jim

[1] While my Acer Iconia A500 tablet was still running Honeycomb, if I
had an uncaught exception in my camera app (which is now on-hold
until the election in November, after which, it may be pointless to
release it at all), a force close would NOT lock the camera.  Once
it upgraded to ICS, that changed, and it DOES get locked up now.  So
I know it doesn't always happen, but you can bet that it will on most
Androids.

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)MiSTie #49997  < Running Mac OS X Lion >
spooky1...@gmail.comICBM/Hurr.: 30.44406N 86.59909W

 No, I'm not going to explain it.  If you can't figure it
 out, you didn't want to know anyway...  --Larry Wall

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] FLASH_MODE_TORCH doesn´t work in Samsung Galaxy Ace

2012-09-22 Thread Harri Smått
Hi,

Are you instantiating 'cam' variable somewhere not shown on the code snippet 
you provided?

--
H

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] FLASH_MODE_TORCH doesn´t work in Samsung Galaxy Ace

2012-09-22 Thread Barragan
Hello!
I´m writing my first time here.

Here my question:
I´m doing a flash light aplication, and my aplication works in all devices 
with flash, but it doesn´t work in some Samsung devices, how Samsung Galaxy 
Ace.
I searched in Internet but i don´t find anything... and maybe help me here.

*My source code is:*

public class MainActivity extends Activity {

private Camera cam;


public void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

setContentView(R.layout.main);


if (cam != null) {

Parameters paramCamera = cam.getParameters();

List modesFlash = paramCamera.getSupportedFlashModes(); 

if (modesFlash != null && 
modesFlash.contains(Camera.Parameters.FLASH_MODE_TORCH)) {

 

paramCamera.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);

try {
cam.setParameters(paramCamera);
cam.startPreview();
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"Error1", Toast.LENGTH_LONG).show();
}

} else {

Toast.makeText(getApplicationContext(),

"Error2", Toast.LENGTH_LONG).show();

}

} else {
Toast.makeText(getApplicationContext(), "Error3", Toast.LENGTH_LONG).show();
}

}

}
 

Thank you so much


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en