above described was 1 way i tried. it was to develop customized camera feature as given in Android guide/ camera... i also tried another way of using existing camera feature but am getting NullPointerException.... can u tel where am going wrong??
On Nov 29, 10:13 am, rachana govilkar <rachana.govil...@gmail.com> wrote: > hey this is my ImageCapture.java......hope u get idea..... > > package com.privacygram.activity; > > import android.content.Context; > import android.graphics.PixelFormat; > import android.hardware.Camera; > import android.hardware.Camera.Parameters; > import android.hardware.Camera.PictureCallback; > import android.hardware.Camera.ShutterCallback; > import android.view.SurfaceHolder; > import android.view.SurfaceView; > > public class ImageCapture extends SurfaceView{ > > SurfaceHolder previewHolder; > Camera camera; > protected PictureCallback raw; > protected ShutterCallback shutter; > protected PictureCallback postview; > protected PictureCallback jpeg; > > public ImageCapture(Context context) { > super(context); > // TODO Auto-generated constructor stub > 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 (Exception E ){ } > } > public void surfaceDestroyed(SurfaceHolder arg0) > { > camera.stopPreview(); > camera.release(); > } > public void surfaceChanged(SurfaceHolder holder, int > format, > int width, int height) > { > Parameters params = camera.getParameters(); > params.setPreviewSize(width, height); > params.setPictureFormat(PixelFormat.JPEG); > camera.setParameters(params); > camera.startPreview(); > > camera.takePicture(shutter, raw, postview, jpeg); > camera.stopPreview(); > camera.release(); > } > }; > > } > > On Nov 28, 6:23 pm, Mark Murphy <mmur...@commonsware.com> wrote: > > > > > > > > > InstantiationException can mean that the activity class is not public > > or lacks a public constructor with the appropriate signature. > > > On Mon, Nov 28, 2011 at 8:07 AM, Raghav Sood > > > <raghavs...@androidactivist.org> wrote: > > > There is a problem in your instantiating your ImageCapture class. Post the > > > first 30 lines or so, and you may get some help. > > > Thanks > > > > On Mon, Nov 28, 2011 at 6:13 PM, rachana govilkar > > > <rachana.govil...@gmail.com> wrote: > > > >> when i test on emulator it gives me error as Your application has > > >> stopped unexpectedly. > > >> n LogCat is:- > > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): FATAL EXCEPTION: main > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): java.lang.RuntimeException: > > >> Unable to instantiate activity ComponentInfo{com.privacygram.activity/ > > >> com.privacygram.activity.ImageCapture}: > > >> java.lang.InstantiationException: > > >> com.privacygram.activity.ImageCapture > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > > >> 2585) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > > >> 2679) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.ActivityThread.access$2300(ActivityThread.java:125) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.os.Handler.dispatchMessage(Handler.java:99) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.os.Looper.loop(Looper.java:123) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.ActivityThread.main(ActivityThread.java:4627) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> java.lang.reflect.Method.invokeNative(Native Method) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> java.lang.reflect.Method.invoke(Method.java:521) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> com.android.internal.os.ZygoteInit > > >> $MethodAndArgsCaller.run(ZygoteInit.java:868) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> dalvik.system.NativeStart.main(Native Method) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): Caused by: > > >> java.lang.InstantiationException: > > >> com.privacygram.activity.ImageCapture > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> java.lang.Class.newInstanceImpl(Native Method) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> java.lang.Class.newInstance(Class.java:1429) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.Instrumentation.newActivity(Instrumentation.java:1021) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): at > > >> android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > > >> 2577) > > >> 11-28 18:10:06.265: E/AndroidRuntime(313): ... 11 more > > > >> On Nov 28, 4:45 pm, Raghav Sood <raghavs...@androidactivist.org> > > >> wrote: > > >> > Try installing it via ADB and post the LogCat. > > > >> > Thanks > > > >> > On Mon, Nov 28, 2011 at 5:12 PM, rachana govilkar < > > > >> > rachana.govil...@gmail.com> wrote: > > >> > > helo.... > > >> > > i developd a small application n started testing on LG 2.2 android > > >> > > device..... > > >> > > but i am getting this error "there is problem parsing the package" > > >> > > when installing .apk file..... > > >> > > i searched this group but i dint get any satisfactory answer..... > > > >> > > <uses-sdk android:minSdkVersion="8" /> > > >> > > i hope this is not causing error....as 2.2 device has same API > > >> > > level... > > >> > > please reply soon.... > > >> > > thnk u in advance > > > >> > > -- > > >> > > 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 > > > >> > -- > > >> > Raghav Soodhttp://www.androidactivist.org/- > > >> > Authorhttp://www.appaholics.in/-Founder > > > >> -- > > >> 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 > > > > -- > > > Raghav Sood > > >http://www.androidactivist.org/-Author > > >http://www.appaholics.in/-Founder > > > > -- > > > 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 > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > Warescription: Three Android Books, Plus Updates, One Low Price! -- 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