Skip to content

Commit

Permalink
Merge pull request #190 from lennonpetrick/master
Browse files Browse the repository at this point in the history
Added a method to use the camera
  • Loading branch information
ArthurHub committed Nov 18, 2016
2 parents 9e53d85 + c3ec812 commit 0d30f65
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.2'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,30 @@ public static Intent getPickImageChooserIntent(@NonNull Context context, CharSeq
return chooserIntent;
}

/**
* Get the main Camera intent for capturing image using device camera app.
* If the outputFileUri is null, a default Uri will be created with {@link #getCaptureImageOutputUri(Context)}, so then
* you will be able to get the pictureUri using {@link #getPickImageResultUri(Context, Intent)}. Otherwise, it is just you use
* the Uri passed to this method.
*
* @param context used to access Android APIs, like content resolve, it is your activity/fragment/widget.
* @param outputFileUri the Uri where the picture will be placed.
*/
public static Intent getCameraIntent(@NonNull Context context, Uri outputFileUri) {

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

if (outputFileUri == null) {

outputFileUri = getCaptureImageOutputUri(context);

}

intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

return intent;
}

/**
* Get all Camera intents for capturing image using device camera apps.
*/
Expand Down

0 comments on commit 0d30f65

Please sign in to comment.