title: Camera with auto focus
body: <p>I'm writing an app in android studio and I need to take a picture of text, that's means the the picture need to be on focus.</p>
  
  <p>Right now I can take pictures but they're not in focus and I can't read the text. I thought using the auto focus but I didn't found a tutorial that teaches how to do that.</p>
  
  <p>My code is:</p>
  
  <pre><code>public class CameraActivity extends AppCompatActivity {
  
      ImageView camView;
      Button camBtn;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_camera);
  
          camView = (ImageView) findViewById(R.id.camView);
          camBtn = (Button) findViewById(R.id.camBTN);
  
          camBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                  startActivityForResult(intent, 100);
              }
          });
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
           super.onActivityResult(requestCode, resultCode, data);
           Bitmap bitmap = (Bitmap) data.getExtras().get("data");
           camView.setImageBitmap(bitmap);
      }
  }
  </code></pre>