title: Android Auto focus doesn't work after creating camera view
body: <p>I am trying to create my own Camera View, I have everything working except the autofocus, I can't seem to figure out why it won't work. Here is my code for CameraView.java</p>
  
  <pre><code>public class CameraView extends SurfaceView implements SurfaceHolder.Callback {
      private SurfaceHolder surface_Holder;
      private  Camera main_Camera;
      boolean on;
  
      public CameraView(Context context, Camera camera){
          super(context);
          main_Camera = camera;
          main_Camera.setDisplayOrientation(90);
          surface_Holder = getHolder();
          surface_Holder.addCallback(this);
          surface_Holder.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
      }
  
      public boolean isOn(){
          return on;
      }
  
  
      @Override
      public void surfaceCreated(SurfaceHolder holder) {
          try{
              main_Camera.setPreviewDisplay(holder);
              main_Camera.startPreview();
          }catch (Exception e){
              Log.d("Error", "Canmera error on surfaceCreated" + e.getMessage());
              main_Camera.release();
              main_Camera = null;
          }
  
      }
  
      @Override
      public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
  
          if(holder.getSurface()==null){
              return;
          }
          try{
              main_Camera.stopPreview();
          }catch (Exception e){
  
          }
          try{
  
              main_Camera.setPreviewDisplay(surface_Holder);
              main_Camera.startPreview();
          }catch (IOException e){
              Log.d("Error", "Camera error on surfaceChanged " + e.getMessage());
          }
      }
  
      @Override
      public void surfaceDestroyed(SurfaceHolder holder) {
          main_Camera.setPreviewCallback(null);
          main_Camera.stopPreview();
          main_Camera.release();
          main_Camera= null;
      }
  }
  </code></pre>
  
  <p>Inside my manifest I have the following:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" /&gt;
  &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  </code></pre>