[android-developers] Re: Camera Application Not Working When I Test on My Phone

2010-09-27 Thread als
Sorry that it's really late and you might not need an answer anymore,
but I've just read this thread.
Maybe your problem is the preview format parameter. Format YUV_422_SP
is not valid in my Motorola Milestone and could be not valid in your
HTC neither. Just try with YUV_420_SP. Is it working now?

-- 
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] Re: Camera Application Not Working When I Test on My Phone

2010-08-20 Thread Chris Maurer
My development environment is windows 7 64 bit. I think I'm using jdk
1.5.20 and not 1.5.21 based on a recommendation from Eclipse.

Chris


On Aug 19, 9:28 pm, Chris Maurer cgmau...@gmail.com wrote:
 I'm trying to test against 1.5 sdk 3.  I'm only trying to access the
 camera and the sd card.

 I don't see anything (or don't know how to use) in the Java Stack
 Trace Console in the Eclipse debug move.

 In the DDMS I keep getting the following

 08-20 01:03:44.452: ERROR/jdwp(875): Failed sending reply to debugger:
 Broken pipe
 08-20 01:03:50.722: ERROR/MediaPlayer(554): Unable to to create media
 player
 08-20 01:03:50.722: ERROR/CameraService(554): Failed to load
 CameraService sounds.
 08-20 01:03:50.742: ERROR/MediaPlayer(554): Unable to to create media
 player
 08-20 01:03:50.742: ERROR/CameraService(554): Failed to load
 CameraService sounds.
 08-20 01:03:50.782: ERROR/Camera(882): _getParameters: picture-
 format=jpeg;picture-size=213x350;preview-format=yuv422sp;preview-frame-
 rate=15;preview-size=176x144
 08-20 01:03:50.812: ERROR/Camera(882): setParameters()

 Should I limit the features of my AVD?  Expand them?

 On Aug 19, 12:32 am, Tommy droi...@gmail.com wrote:



  What is the OS version are you testing on? What features of the camera are
  you using. I had the same issue due to trying to call the flash feature on a
  1.5 device. They don't support flash. So a list of the features would be
  helpful and the OS version your testing on. I had a few issues I had to
  figure out trying to work with the camera.

  -Original Message-
  From: android-developers@googlegroups.com

  [mailto:android-develop...@googlegroups.com] On Behalf Of Mark Murphy
  Sent: Thursday, August 19, 2010 12:23 AM
  To: android-developers@googlegroups.com
  Subject: Re: [android-developers] Re: Camera Application Not Working When I
  Test on My Phone

  On Wed, Aug 18, 2010 at 8:51 PM, Chris Maurer cgmau...@gmail.com wrote:
   When I step through the code I get an error in Looper.loop() line:124
   after the onCreate function.

  That information is not especially useful. We would need the stack
  trace, at least to the point where your own code starts showing up.

   i apologize for my ignorance, but what will the Java stack trace look
   like in logcat

  Generally, it will look like a Java stack trace does everywhere else
  you do Java development.

 http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/

  In DDMS, it will be colored red. Also, some Android stack traces are
  in two halves, the bottom half labeled Caused by -- that'd be the
  more relevant half.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

  _The Busy Coder's Guide to Android Development_ Version 3.1 Available!

  --
  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 
  athttp://groups.google.com/group/android-developers?hl=en

-- 
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] Re: Camera Application Not Working When I Test on My Phone

2010-08-19 Thread Chris Maurer
I'm trying to test against 1.5 sdk 3.  I'm only trying to access the
camera and the sd card.

I don't see anything (or don't know how to use) in the Java Stack
Trace Console in the Eclipse debug move.

In the DDMS I keep getting the following

08-20 01:03:44.452: ERROR/jdwp(875): Failed sending reply to debugger:
Broken pipe
08-20 01:03:50.722: ERROR/MediaPlayer(554): Unable to to create media
player
08-20 01:03:50.722: ERROR/CameraService(554): Failed to load
CameraService sounds.
08-20 01:03:50.742: ERROR/MediaPlayer(554): Unable to to create media
player
08-20 01:03:50.742: ERROR/CameraService(554): Failed to load
CameraService sounds.
08-20 01:03:50.782: ERROR/Camera(882): _getParameters: picture-
format=jpeg;picture-size=213x350;preview-format=yuv422sp;preview-frame-
rate=15;preview-size=176x144
08-20 01:03:50.812: ERROR/Camera(882): setParameters()

Should I limit the features of my AVD?  Expand them?


On Aug 19, 12:32 am, Tommy droi...@gmail.com wrote:
 What is the OS version are you testing on? What features of the camera are
 you using. I had the same issue due to trying to call the flash feature on a
 1.5 device. They don't support flash. So a list of the features would be
 helpful and the OS version your testing on. I had a few issues I had to
 figure out trying to work with the camera.



 -Original Message-
 From: android-developers@googlegroups.com

 [mailto:android-develop...@googlegroups.com] On Behalf Of Mark Murphy
 Sent: Thursday, August 19, 2010 12:23 AM
 To: android-developers@googlegroups.com
 Subject: Re: [android-developers] Re: Camera Application Not Working When I
 Test on My Phone

 On Wed, Aug 18, 2010 at 8:51 PM, Chris Maurer cgmau...@gmail.com wrote:
  When I step through the code I get an error in Looper.loop() line:124
  after the onCreate function.

 That information is not especially useful. We would need the stack
 trace, at least to the point where your own code starts showing up.

  i apologize for my ignorance, but what will the Java stack trace look
  like in logcat

 Generally, it will look like a Java stack trace does everywhere else
 you do Java development.

 http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/

 In DDMS, it will be colored red. Also, some Android stack traces are
 in two halves, the bottom half labeled Caused by -- that'd be the
 more relevant half.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 3.1 Available!

 --
 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 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
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] Re: Camera Application Not Working When I Test on My Phone

2010-08-18 Thread Chris Maurer
Hi Mark,

Here's the messages I get consistently when I start up the application

08-19 00:01:03.135: ERROR/MediaPlayer(31): Unable to to create media
player
08-19 00:01:03.135: ERROR/CameraService(31): Failed to load
CameraService sounds.
08-19 00:01:03.145: ERROR/MediaPlayer(31): Unable to to create media
player
08-19 00:01:03.165: ERROR/CameraService(31): Failed to load
CameraService sounds.


On Aug 18, 12:26 am, Mark Murphy mmur...@commonsware.com wrote:
 Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
 the Java stack trace associated with your error.





 On Wed, Aug 18, 2010 at 12:11 AM, Chris Maurer cgmau...@gmail.com wrote:
  I have a HTC Incredible and I'm trying to write a simple application
  to take a picture and save it on the SD card.  When I run the tutorial
  athttp://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture
  it works fine in the emulator.  However, when I try and test it on my
  phone I get The application Picture Demo (process
  com.commonsware.android.camera) has stopped unexpectedly.  Please try
  again.

  I have set the following permissions in the AndroidManifest file.

  uses-feature android:name=android.hardware.camera /
  uses-permission android:name=android.permission.CAMERA /
  uses-permission
  android:name=android.permission.WRITE_EXTERNAL_STORAGE /

  Below is the code I am using.

  import android.app.Activity;
  import android.graphics.PixelFormat;
  import android.hardware.Camera;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.os.Environment;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.SurfaceHolder;
  import android.view.SurfaceView;
  import android.widget.Toast;
  import java.io.File;
  import java.io.FileOutputStream;

  public class PictureDemo extends Activity {
         private SurfaceView preview=null;
         private SurfaceHolder previewHolder=null;
         private Camera camera=null;

        �...@override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);

                 preview=(SurfaceView)findViewById(R.id.preview);
                 previewHolder=preview.getHolder();
                 previewHolder.addCallback(surfaceCallback);
                 
  previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
         }

        �...@override
         public boolean onKeyDown(int keyCode, KeyEvent event) {
                 if (keyCode==KeyEvent.KEYCODE_CAMERA ||
                                 keyCode==KeyEvent.KEYCODE_SEARCH) {
                         takePicture();

                         return(true);
                 }

                 return(super.onKeyDown(keyCode, event));
         }

         private void takePicture() {
                 camera.takePicture(null, null, photoCallback);
         }

         SurfaceHolder.Callback surfaceCallback=new SurfaceHolder.Callback() {
                 public void surfaceCreated(SurfaceHolder holder) {
                         camera=Camera.open();

                         try {
                                 camera.setPreviewDisplay(previewHolder);
                         }
                         catch (Throwable t) {
                                 Log.e(PictureDemo-surfaceCallback,
                                                         Exception in 
  setPreviewDisplay(), t);
                                 Toast
                                         .makeText(PictureDemo.this, 
  t.getMessage(), Toast.LENGTH_LONG)
                                         .show();
                         }
                 }

                 public void surfaceChanged(SurfaceHolder holder,
                                                                              
                                              int format, int width,
                                                                              
                                              int height) {
                         Camera.Parameters parameters=camera.getParameters();

                         parameters.setPreviewSize(width, height);
                         parameters.setPictureFormat(PixelFormat.JPEG);

                         camera.setParameters(parameters);
                         camera.startPreview();
                 }

                 public void surfaceDestroyed(SurfaceHolder holder) {
                         camera.stopPreview();
                         camera.release();
                         camera=null;
                 }
         };

         Camera.PictureCallback photoCallback=new Camera.PictureCallback() {
                 public void onPictureTaken(byte[] data, Camera camera) {
                         new SavePhotoTask().execute(data);
                         camera.startPreview();
                 }
         };

         class SavePhotoTask extends AsyncTaskbyte[], String, 

Re: [android-developers] Re: Camera Application Not Working When I Test on My Phone

2010-08-18 Thread Mark Murphy
On Wed, Aug 18, 2010 at 8:10 PM, Chris Maurer cgmau...@gmail.com wrote:
 Here's the messages I get consistently when I start up the application

 08-19 00:01:03.135: ERROR/MediaPlayer(31): Unable to to create media
 player
 08-19 00:01:03.135: ERROR/CameraService(31): Failed to load
 CameraService sounds.
 08-19 00:01:03.145: ERROR/MediaPlayer(31): Unable to to create media
 player
 08-19 00:01:03.165: ERROR/CameraService(31): Failed to load
 CameraService sounds.

FWIW, I just tested it on an Incredible and have no problems.

Also, your errors there probably are not your problem. If you are
getting a Force Close dialog, there will be a Java stack trace you
need to examine in LogCat.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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] Re: Camera Application Not Working When I Test on My Phone

2010-08-18 Thread Chris Maurer
i apologize for my ignorance, but what will the Java stack trace look
like in logcat

On Aug 18, 8:21 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Wed, Aug 18, 2010 at 8:10 PM, Chris Maurer cgmau...@gmail.com wrote:
  Here's the messages I get consistently when I start up the application

  08-19 00:01:03.135: ERROR/MediaPlayer(31): Unable to to create media
  player
  08-19 00:01:03.135: ERROR/CameraService(31): Failed to load
  CameraService sounds.
  08-19 00:01:03.145: ERROR/MediaPlayer(31): Unable to to create media
  player
  08-19 00:01:03.165: ERROR/CameraService(31): Failed to load
  CameraService sounds.

 FWIW, I just tested it on an Incredible and have no problems.

 Also, your errors there probably are not your problem. If you are
 getting a Force Close dialog, there will be a Java stack trace you
 need to examine in LogCat.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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] Re: Camera Application Not Working When I Test on My Phone

2010-08-18 Thread Chris Maurer
When I step through the code I get an error in Looper.loop() line:124
after the onCreate function.

On Aug 18, 12:26 am, Mark Murphy mmur...@commonsware.com wrote:
 Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
 the Java stack trace associated with your error.





 On Wed, Aug 18, 2010 at 12:11 AM, Chris Maurer cgmau...@gmail.com wrote:
  I have a HTC Incredible and I'm trying to write a simple application
  to take a picture and save it on the SD card.  When I run the tutorial
  athttp://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture
  it works fine in the emulator.  However, when I try and test it on my
  phone I get The application Picture Demo (process
  com.commonsware.android.camera) has stopped unexpectedly.  Please try
  again.

  I have set the following permissions in the AndroidManifest file.

  uses-feature android:name=android.hardware.camera /
  uses-permission android:name=android.permission.CAMERA /
  uses-permission
  android:name=android.permission.WRITE_EXTERNAL_STORAGE /

  Below is the code I am using.

  import android.app.Activity;
  import android.graphics.PixelFormat;
  import android.hardware.Camera;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.os.Environment;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.SurfaceHolder;
  import android.view.SurfaceView;
  import android.widget.Toast;
  import java.io.File;
  import java.io.FileOutputStream;

  public class PictureDemo extends Activity {
         private SurfaceView preview=null;
         private SurfaceHolder previewHolder=null;
         private Camera camera=null;

        �...@override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);

                 preview=(SurfaceView)findViewById(R.id.preview);
                 previewHolder=preview.getHolder();
                 previewHolder.addCallback(surfaceCallback);
                 
  previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
         }

        �...@override
         public boolean onKeyDown(int keyCode, KeyEvent event) {
                 if (keyCode==KeyEvent.KEYCODE_CAMERA ||
                                 keyCode==KeyEvent.KEYCODE_SEARCH) {
                         takePicture();

                         return(true);
                 }

                 return(super.onKeyDown(keyCode, event));
         }

         private void takePicture() {
                 camera.takePicture(null, null, photoCallback);
         }

         SurfaceHolder.Callback surfaceCallback=new SurfaceHolder.Callback() {
                 public void surfaceCreated(SurfaceHolder holder) {
                         camera=Camera.open();

                         try {
                                 camera.setPreviewDisplay(previewHolder);
                         }
                         catch (Throwable t) {
                                 Log.e(PictureDemo-surfaceCallback,
                                                         Exception in 
  setPreviewDisplay(), t);
                                 Toast
                                         .makeText(PictureDemo.this, 
  t.getMessage(), Toast.LENGTH_LONG)
                                         .show();
                         }
                 }

                 public void surfaceChanged(SurfaceHolder holder,
                                                                              
                                              int format, int width,
                                                                              
                                              int height) {
                         Camera.Parameters parameters=camera.getParameters();

                         parameters.setPreviewSize(width, height);
                         parameters.setPictureFormat(PixelFormat.JPEG);

                         camera.setParameters(parameters);
                         camera.startPreview();
                 }

                 public void surfaceDestroyed(SurfaceHolder holder) {
                         camera.stopPreview();
                         camera.release();
                         camera=null;
                 }
         };

         Camera.PictureCallback photoCallback=new Camera.PictureCallback() {
                 public void onPictureTaken(byte[] data, Camera camera) {
                         new SavePhotoTask().execute(data);
                         camera.startPreview();
                 }
         };

         class SavePhotoTask extends AsyncTaskbyte[], String, String {
                �...@override
                 protected String doInBackground(byte[]... jpeg) {
                         File photo=new 
  File(Environment.getExternalStorageDirectory(),
                                                                              
                             

Re: [android-developers] Re: Camera Application Not Working When I Test on My Phone

2010-08-18 Thread Mark Murphy
On Wed, Aug 18, 2010 at 8:51 PM, Chris Maurer cgmau...@gmail.com wrote:
 When I step through the code I get an error in Looper.loop() line:124
 after the onCreate function.

That information is not especially useful. We would need the stack
trace, at least to the point where your own code starts showing up.

 i apologize for my ignorance, but what will the Java stack trace look
 like in logcat

Generally, it will look like a Java stack trace does everywhere else
you do Java development.

http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/

In DDMS, it will be colored red. Also, some Android stack traces are
in two halves, the bottom half labeled Caused by -- that'd be the
more relevant half.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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] Re: Camera Application Not Working When I Test on My Phone

2010-08-18 Thread Tommy
What is the OS version are you testing on? What features of the camera are
you using. I had the same issue due to trying to call the flash feature on a
1.5 device. They don't support flash. So a list of the features would be
helpful and the OS version your testing on. I had a few issues I had to
figure out trying to work with the camera.

-Original Message-
From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Mark Murphy
Sent: Thursday, August 19, 2010 12:23 AM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Re: Camera Application Not Working When I
Test on My Phone

On Wed, Aug 18, 2010 at 8:51 PM, Chris Maurer cgmau...@gmail.com wrote:
 When I step through the code I get an error in Looper.loop() line:124
 after the onCreate function.

That information is not especially useful. We would need the stack
trace, at least to the point where your own code starts showing up.

 i apologize for my ignorance, but what will the Java stack trace look
 like in logcat

Generally, it will look like a Java stack trace does everywhere else
you do Java development.

http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/

In DDMS, it will be colored red. Also, some Android stack traces are
in two halves, the bottom half labeled Caused by -- that'd be the
more relevant half.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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

-- 
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