Hi All! Im trying to go give an introduction to myself for camera applications -by watching a tutorial- on Android however getting very sad same error everytime i debug, which is application force to shut down..
Will be very appreciate for any kind help.. This is my Activity Class : package com.AndroidAR; import android.app.Activity; import android.os.Bundle; import android.widget.FrameLayout; public class AndroidAR extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CustomCameraView cv = new CustomCameraView( this.getApplicationContext()); FrameLayout rl = new FrameLayout(this.getApplicationContext()); setContentView(rl); rl.addView(cv); }} And this is CustomCameraView with Surfaceview package com.AndroidAR; import java.io.IOException; import android.content.Context; import android.graphics.PixelFormat; import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.view.SurfaceHolder; import android.view.SurfaceView; public class CustomCameraView extends SurfaceView { Camera camera; SurfaceHolder previewHolder; public CustomCameraView(Context context) { super(context); previewHolder = this.getHolder(); previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); previewHolder.addCallback(surfaceHolderListener); } SurfaceHolder.Callback surfaceHolderListener = new SurfaceHolder.Callback() { public void surfaceCreated(SurfaceHolder holder) { camera=Camera.open(); try { camera.setPreviewDisplay(previewHolder); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }} public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Parameters params = camera.getParameters(); int w = 0; int h =0; params.setPreviewSize(w, h); params.setPictureFormat(PixelFormat.JPEG); camera.setParameters(params); camera.startPreview(); } public void surfaceDestroyed(SurfaceHolder arg0) { camera.stopPreview(); camera.release(); } };} Plus the manifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android" android:versionCode="8" android:versionName="2.2"> <uses-permission android:name="android.permission.CAMERA"></uses-permission> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <application android:icon="@drawable/icon" android:label="@string/app_name" > <activity android:name=".AndroidAR" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> Im using Android 2.2 on my HTC Desire, however the phone or the emulator are outputting same error.. -- *Orkun * -- 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