Hi,

I am trying to use the PreviewCallback but i get an IOException
saying:
"startPreview failed". I run the emulator in the debugger.   Is there
a complete sample somewhere using the PreviewCallback. I have now for
great ideas of applications that i want to make but they all use the
the PreviewCallback since i want to be able put overlays and filter
what is seen through the camera. I have tried other forums for help
but it i cant get any and that is probably because there is a bug in
how the data parameter to the callback is represented.

(However i am very grateful for such a good SDK and emulator..  love
android)

----
public class CamApp extends Activity implements Camera.PreviewCallback
{

     @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SurfaceView surfView = new SurfaceView(this);
        setContentView(surfView);

        Camera cam = Camera.open();
        Camera.Parameters parameters = cam.getParameters();
        parameters.setPreviewSize(100, 100);
        cam.setParameters(parameters);
        cam.setPreviewCallback(this);
        cam.startPreview();

    }

     @Override
     public void onPreviewFrame(byte[] data, Camera camera) {

     }

}

---------

Stack:

Thread [<3> main] (Suspended (exception RuntimeException))
   ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord)
line: 2140   <--- Here is where i can see the IOException
   ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord)
line: 2156
   ActivityThread.access$1800(ActivityThread, ActivityThread
$ActivityRecord) line: 112
   ActivityThread$H.handleMessage(Message) line: 1580
   ActivityThread$H(Handler).dispatchMessage(Message) line: 88
   Looper.loop() line: 123
   ActivityThread.main(String[]) line: 3742
   Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
   Method.invoke(Object, Object...) line: 515
   ZygoteInit$MethodAndArgsCaller.run() line: 739
   ZygoteInit.main(String[]) line: 497
   NativeStart.main(String[]) line: not available [native method]





--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to