title: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE cmp=android/com.android.internal.app.ResolverActivity }
body: <p>Please help! Camera cannot open when i click it. I'm using android M, maybe that's the problem. please help me how to open the camera...
  I'm trying to add some permission but it still doesn't work. I'm already use `</p>
  
  <p>but it still doesn't work. please help</p>
  
  <p><strong>this is my code</strong></p>
  
  <pre><code>public class TambahLaporActivity extends AppCompatActivity {
  
      ImageView imageView;
      Integer REQUEST_CAMERA = 1, SELECT_FILE = 0;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_tambah_lapor);
  
          imageView = (ImageView) findViewById(R.id.image);
  
          CardView imageView = (CardView) findViewById(R.id.cv);
          //set a clickListener on that view
          imageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  SelectImage();
              }
          });
      }
  
      private void SelectImage() {
          final CharSequence[] items = { "Camera", "Gallery", "Cancel" };
  
          AlertDialog.Builder builder = new AlertDialog.Builder(TambahLaporActivity.this);
          builder.setTitle("Add Image");
          builder.setItems(items, new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
                  if (items[i].equals("Camera")) {
                      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                      startActivityForResult(intent, REQUEST_CAMERA);
  
                  } else if (items[i].equals("Gallery")) {
                      Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                      intent.setType("image/*");
                      startActivityForResult(intent.createChooser(intent, "Select Type"), SELECT_FILE);
                  } else if (items[i].equals("Cancel")) {
                      dialogInterface.dismiss();
                  }
              }
          });
          builder.show();
      }
  
      @Override
      public void onActivityResult(int requenstCode, int resultCode, Intent data) {
          super.onActivityResult(requenstCode, resultCode, data);
  
          if (resultCode == Activity.RESULT_OK) {
              if (requenstCode == REQUEST_CAMERA) {
                  Bitmap bitmap = (Bitmap) data.getExtras().get("data");
                  imageView.setImageBitmap(bitmap);
              } else if (requenstCode == SELECT_FILE) {
                  Uri selectedImageUri = data.getData();
                  imageView.setImageURI(selectedImageUri);
              }
          }
      }
  }
  </code></pre>