Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a method to use the camera #190

Merged
merged 1 commit into from
Nov 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -191,6 +191,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