Note that there are some explanatory texts on larger screens.

plurals
  1. POVideo Camera Zoom
    primarykey
    data
    text
    <p>I'm implementing an Android app that record video. I'm trying to implement the zoom functionality but I'm not able to let it work. I haven't not found around any good code. I post the piece of code I have tried. this code is inside the OnCreate method in the Main Activity in which I'm implementing the video recording:</p> <pre><code>ImageView test = (ImageView) findViewById(R.id.zoom); test.setClickable(true); test.setOnClickListener(new OnClickListener() { public void onClick(View v) { Context context4 = getApplicationContext(); int duration = Toast.LENGTH_SHORT; Camera.Parameters parameters = mCamera.getParameters(); parameters.setZoom(parameters.getMaxZoom()); boolean Zoom = parameters.isZoomSupported(); int maxZoom = parameters.getMaxZoom(); if (parameters.isZoomSupported()) { if (zoom &gt;=0 &amp;&amp; zoom &lt; parameters.getMaxZoom()) { parameters.setZoom(parameters.getZoom()+1); parameters.setZoom(zoom); mCamera.setParameters(parameters); Toast.makeText(context4, "Zoom Setted: "+parameters.getZoom(), duration).show(); } else { // zoom parameter is incorrect Toast.makeText(context4, "Zoom NOT Setted", duration).show(); } } } }); </code></pre> <p>So what I have is an image view called "zoom" that when clicked should increase the zoom of the video preview till reaching the max zoom allowed!!! This what I would like to implement in theory but nothing happen when I click the imageview....neither showing any toast! I'm testing it on a Nexus s. Someone knows how to modifiy this code in order to work or someone tried to implement in a different way? If yes how can I do? PS: The paramameter zoom is defined above as an int initialized to 1.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload