c# - How to take a picture in Xamarin? -


i trying take picture using camera class android.hardware. getting feed , camera getting auto-foucs. problem not know how take photo.

_camera = camera.open(); camera.parameters param = _camera.getparameters(); param.focusmode = camera.parameters.focusmodecontinuouspicture; _camera.setparameters(param);   var previewsize = _camera.getparameters().previewsize; _textureview.layoutparameters =     new framelayout.layoutparams(previewsize.width,         previewsize.height, gravityflags.center);  try {     _camera.setpreviewtexture(surface);     _camera.startpreview(); } catch (java.io.ioexception ex) {     system.console.writeline(ex.message); }  // sort of thing textureview enables _textureview.rotation = 90.0f; 

the takepicture-method 1 looking for. use need implement interfaces. ipicturecallback receive picture in onpicturetaken.

a sample implementation this:

public void onpicturetaken(byte[] data, android.hardware.camera camera) {     camera.stoppreview();     toast.maketext(this, "cheese", toastlength.short).show();     camera.startpreview(); } 

to prevent app hangs need stop preview , (re-)start again.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -