I am trying to use the PreviewCallback but i get an IOException
saying:
"startPreview failed". I run the emulator in the debugger. I am pretty
stuck here. Are there any examples using the PreviewCallback. It would
be so nice to get this working since i have 4 great ideas for
applications that all need to use the camera preview and apply a
filter or overlay.

Thanx.


The code that fails:

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 Trace
Code:

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 [email protected]
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