Saturday, 15 August 2015

android - java.lang.RuntimeException: setParameters failed in Camera Api -



android - java.lang.RuntimeException: setParameters failed in Camera Api -

i developing photographic camera overly app in using photographic camera api preview , overlay effects.i getting forcefulness close error in mobiles , not happening other mobiles.

my code:

parameters = camera.getparameters(); list<size> sizes = parameters.getsupportedpreviewsizes(); size optimalsize = getoptimalpreviewsize(sizes, w, h); parameters.setpreviewsize(optimalsize.width, optimalsize.height); parameters.setcoloreffect(camera.parameters.effect_solarize); setcameradisplayorientation(mainactivity.this,0, camera); camera.getparameters(); camera.setparameters(parameters);

these phone call stacks getting

java.lang.runtimeexception: setparameters failed @ android.hardware.camera.native_setparameters(native method) @ android.hardware.camera.setparameters(camera.java:1046) @ com.androidpixels.watercamera.mainactivity.surfacechanged(mainactivity.java:1241) @ android.view.surfaceview.updatewindow(surfaceview.java:575) @ android.view.surfaceview.updatewindow(surfaceview.java:407) @ android.view.surfaceview.dispatchdraw(surfaceview.java:352) @ android.view.viewgroup.drawchild(viewgroup.java:1644) @ android.view.viewgroup.dispatchdraw(viewgroup.java:1373) @ android.view.viewgroup.drawchild(viewgroup.java:1644) @ android.view.viewgroup.dispatchdraw(viewgroup.java:1373) @ android.view.viewgroup.drawchild(viewgroup.java:1644) @ android.view.viewgroup.dispatchdraw(viewgroup.java:1373) @ android.view.view.draw(view.java:6936) @ android.widget.framelayout.draw(framelayout.java:357) @ com.android.internal.policy.impl.phonewindow$decorview.draw(phonewindow.java:1917) @ android.view.viewroot.draw(viewroot.java:1530) @ android.view.viewroot.performtraversals(viewroot.java:1266) @ android.view.viewroot.handlemessage(viewroot.java:1868) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:130) @ android.app.activitythread.main(activitythread.java:3693) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:907) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:665) @ dalvik.system.nativestart.main(native method)

please help me. reason?

android photographic camera parameters vary between devices. need verify device supports parameter you're trying set before setting it, see camera setparameters doc

you can query supported parameters :

obtain parameters object : camera.parameters params = mcamera.getparameters();

then query object specific parameter , previewsize:

params.getsupportedpreviewsizes ()

android camera

No comments:

Post a Comment