i am try to preview the Camera. i copied code for sdk sample and past it in my code,still is showing following Error
ActivityManager: Starting: Intent { comp={com.android/com.android.Camera} }
ActivityManager: Error: Activity class {com.android/com.android.Camera} does not exist.
My Code is:]
Using java Syntax Highlighting
- import android.app.Activity;
- import android.content.Context;
- import android.graphics.Canvas;
- import android.graphics.PixelFormat;
- import android.hardware.CameraDevice;
- import android.os.Bundle;
- import android.view.SurfaceHolder;
- import android.view.SurfaceView;
- import android.view.Window;
- public class Camera extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- getWindow().setFormat(PixelFormat.TRANSLUCENT);
- setContentView(new Preview(this));
- }
- @Override
- protected boolean isFullscreenOpaque() {
- // TODO Auto-generated method stub
- return true;
- }
- @Override
- protected void onPause() {
- super.onPause();
- }
- @Override
- protected void onResume() {
- super.onResume();
- }
- }
- class Preview extends SurfaceView implements SurfaceHolder.Callback
- {
- SurfaceHolder mHolder;
- private PreviewThread mPreviewThread;
- private boolean mHasSurface;
- Preview(Context context)
- {
- super(context);
- mHolder=getHolder();
- mHolder.setCallback(this);
- mHasSurface=false;
- mHolder.setFixedSize(320,240);
- }
- public boolean surfaceCreated(SurfaceHolder holder)
- {
- mHasSurface=true;
- if(mPreviewThread!=null)
- {
- mPreviewThread.start();
- }
- return true;
- }
- public void surfaceDestroyed(SurfaceHolder holder) {
- // Surface will be destroyed when we return. Stop the preview.
- mHasSurface = false;
- }
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- // Surface size or format has changed. This should not happen in this
- // example.
- }
- class PreviewThread extends Thread
- {
- private boolean mDone;
- public PreviewThread() {
- super();
- mDone=false;
- }
- @Override
- public void run() {
- CameraDevice camera=CameraDevice.open();
- if(camera!=null)
- {
- CameraDevice.CaptureParams param=new CameraDevice.CaptureParams();
- param.type=1;
- param.srcWidth = 1280;
- param.srcHeight = 960;
- param.leftPixel = 0;
- param.topPixel = 0;
- param.outputWidth = 320;
- param.outputHeight = 240;
- param.dataFormat = 2; // RGB_565
- camera.setCaptureParams(param);
- }
- SurfaceHolder hoder=mHolder;
- while(!mDone)
- {
- Canvas canvas=hoder.lockCanvas();
- // Capture directly into the Surface
- if (camera != null) {
- camera.capture(canvas);
- }
- // And finally unlock and post the surface.
- hoder.unlockCanvasAndPost(canvas);
- }
- // Make sure to release the CameraDevice
- if (camera != null)
- camera.close();
- }
- }
- }
Parsed in 0.043 seconds, using GeSHi 1.0.8.4
Can u any one help me please???

