Documentation - https://developer.android.com/training/camera/photobasics
I have followed all the required steps to capture image using camera.
private void dispatchTakePictureIntent() {
    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // its always null
        startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
    }
}
takePictureIntent.resolveActivity(getPackageManager()) - this line always returns null. and if i skip this check than camera opens but app crashes.
 
     
    