Sending Camera Intent

In the 16.8 listing, there is a piece of code that confuses me:
boolean canTakePhoto = mPhotoFile != null &&
captureImage.resolveActivity(packageManager) != null;
mPhotoButton.setEnabled(canTakePhoto);

Add code to ensure that the button is disabled if there is no camera app pr if there is no location at which to save the photo

How does “mPhotoFiles != null” determine if there is no location to save photo at?

Hello,
This link (android develope SDK) describes the File object nicely.
Then,you can see in the example use the getFilesDir() in getPhotoFile() method of CrimeLab class.
The getFilesDir() method is Returns the absolute path to the directory on the filesystem similar to.
Note for more explanation: you can see what it is written when you can click the method.

  public File getPhotoFile(CrimeDec crimedec){
        File filesDir = mContext.getFilesDir();
        return new File(filesDir,crimedec.getPhotoFilename());
}

So, You have called the code with this method (`mPhotoFile = CrimeLab.get(getActivity()).getPhotoFile(mCrime);’) in the CrimeFragment class.

mPhotoFiles != null checks that there is no location.

in addition, the MediaStore used in the following code explains that
The Media provider contains meta data for all available media on both internal and external storage devices.

captureImage = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

so this constant(ACTION_IMAGE_CAPTURE) is the Standard Intent action that can be sent to have the camera application capture an image and return it.

for more explaination

Finally, I think,
you can check whether there are a picture and a location at the same time.

I can not quite understand in what cases mPhonoFile can be null. Thank you for your reply.