Q:

How does the GDK android camera example work?

So I'm a little confused about what is going on towards the end of this code (inside processPictureWhenReady()). Before this method is called (within onActivityResult()) we have the image file path... So a file has already been stored. We then have the file declaration pictureFile using the filepath of the image (picturePath). Can someone explain why we have to declare a file using the same file path despite the fact that the file already exists ? Please don't just refer me back to the Google developers website as I have not found this useful.
private static final int TAKE_PICTURE_REQUEST = 1;

private void takePicture() {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(intent, TAKE_PICTURE_REQUEST);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == TAKE_PICTURE_REQUEST && resultCode == RESULT_OK) {
        String thumbnailPath = data.getStringExtra(Intents.EXTRA_THUMBNAIL_FILE_PATH);
        String picturePath = data.getStringExtra(Intents.EXTRA_PICTURE_FILE_PATH);

        processPictureWhenReady(picturePath);
        // TODO: Show the thumbnail to the user while the full picture is being
        // processed.
    }

    super.onActivityResult(requestCode, resultCode, data);
}

private void processPictureWhenReady(final String picturePath) {
    final File pictureFile = new File(picturePath);

    if (pictureFile.exists()) {
        // The picture is ready; process it.
    } else {
        // The file does not exist yet. Before starting the file observer, you
        // can update your UI to let the user know that the application is
        // waiting for the picture (for example, by displaying the thumbnail
        // image and a progress indicator).

        final File parentDirectory = pictureFile.getParentFile();
        FileObserver observer = new FileObserver(parentDirectory.getPath(),
            FileObserver.CLOSE_WRITE | FileObserver.MOVED_TO) {
            // Protect against additional pending events after CLOSE_WRITE
            // or MOVED_TO is handled.
            private boolean isFileWritten;

        @Override
        public void onEvent(int event, String path) {
            if (!isFileWritten) {
                // For safety, make sure that the file that was created in
                // the directory is actually the one that we're expecting.
                File affectedFile = new File(parentDirectory, path);
                isFileWritten = affectedFile.equals(pictureFile);

                if (isFileWritten) {
                    stopWatching();

                    // Now that the file is ready, recursively call
                    // processPictureWhenReady again (on the UI thread).
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            processPictureWhenReady(picturePath);
                        }
                    });
                }
            }
        }
    };
    observer.startWatching();
}
}

A:

You are referring, I presume, to this line:
final File pictureFile = new File(picturePath);

What they have done is created an instance of a File object from the file path where that image is stored. This File object is what they need to do some processing on the image. The File object is an abstraction of the image file in memory, NOT the actual physical file. As I understand it, you seem to be mistaking the two.

