Code example for RuntimeException

            return MIME_TYPE_JPEG;
        else if (extension.equals("mpo")) {
            return MIME_TYPE_MPO;
        throw new RuntimeException("Unsupported image extension type: " + extension);
    public static Uri addImage(ContentResolver resolver, String title, String extension, long date,
                Location location, int orientation, byte[] jpeg, int width, int height) {
        // Save the image. 
        String path = generateFilepath(title, extension);
        FileOutputStream out = null;
        try { 
            out = new FileOutputStream(path);
        } catch (Exception e) {
            Log.e(TAG, "Failed to write image", e);
            return null; 
        } finally { 
Connect your IDE to all the code out there  Get Codota for Java