Skip to content

Commit

Permalink
Merge pull request #9 from googlesamples/caren/merge_android_snippet_…
Browse files Browse the repository at this point in the history
…improvements

Android code snippets: Update examples to show how to use default options
  • Loading branch information
calren authored Jun 8, 2020
2 parents 61a4fe7 + 2c3370b commit 734af50
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ private void detectFaces(InputImage image) {

// [START get_detector]
FaceDetector detector = FaceDetection.getClient(options);
// Or, to use the default option:
// FaceDetector detector = FaceDetection.getClient();
// [END get_detector]

// [START run_detector]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,9 @@ public void onFailure(@NonNull Exception e) {
}

private void configureAndRunImageLabeler(InputImage image) {
ImageLabelerOptions options =
new ImageLabelerOptions.Builder()
.build();

// [START on_device_image_labeler]
ImageLabeler labeler = ImageLabeling.getClient(options);
// To use default options:
ImageLabeler labeler = ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS);

// Or, to set the minimum confidence required:
// ImageLabelerOptions options =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class FaceDetectionActivity : AppCompatActivity() {

// [START get_detector]
val detector = FaceDetection.getClient(options)
// Or, to use the default option:
// val detector = FaceDetection.getClient();
// [END get_detector]

// [START run_detector]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ class ImageLabelingActivity : AppCompatActivity() {
}

private fun configureAndRunImageLabeler(image: InputImage) {
val options = ImageLabelerOptions.Builder()
.build()

// [START on_device_image_labeler]
val labeler = ImageLabeling.getClient(options)
// To use default options:
val labeler = ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS)

// Or, to set the minimum confidence required:
// val options = ImageLabelerOptions.Builder()
Expand Down

0 comments on commit 734af50

Please sign in to comment.