From 470dfcbabcba72ba4d0725c4a138c315f6f17200 Mon Sep 17 00:00:00 2001 From: Erick Moo Date: Mon, 5 Nov 2018 13:11:51 -0500 Subject: [PATCH] update Camera index.html 'compile' keyword is deprecated, replaced with 'implementation' --- tutorials/Camera/index.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tutorials/Camera/index.html b/tutorials/Camera/index.html index 6eaf66f..1e35b49 100644 --- a/tutorials/Camera/index.html +++ b/tutorials/Camera/index.html @@ -16,14 +16,14 @@ background: var(--google-codelab-background, #F8F9FA); } - + - +

This tutorial will show you how to capture and save images for your Android app. In this tutorial you will do the following:

    @@ -43,14 +43,14 @@ - +

    Similar to the UI tutorial you'll want to set up a new project. This time, like last time, make it a blank project.
    The only difference is that now you should name it something along the lines of "Camera Tutorial" because I am still boring.
    Again, pick an empty activity since it's more fun for us to build from scratch!

    New Application ready to go!

    - +

    Since we are using a camera in our application, we need to ensure that our app will not get installed on any device that does not have a camera.
    To do this we need to add a few lines to the manifest file.

    The manifest file is conveniently located in the manifests folder. Double click on it to open it.
    Manifest file location

    @@ -70,7 +70,7 @@
    - +

    Because we want to keep our app simple we want our GUI to have three things. First, we want a button to click in order to take a picture. Second, we want a ImageView to display the picture that we've just taken. Finally, let's add in a text box so we can display the name and path of the picture we've just taken.

    Putting this together should be a breeze if you've gone through the first tutorial. The only addition is a TextView (so it displays text but doesn't accept input text). With a little effort you should end up with a GUI similar to the one below:
    GUI layout to mimick

    @@ -79,7 +79,7 @@
    - +

    Starting image capture

    The most basic function of this app is to take a picture when you click the button. To do this we'll be creating an intent object and starting the activity to take the picture. There are three main components to this.

    @@ -122,7 +122,7 @@

    Displaying the image!

    - +

    The reason the image looks so lousy is because it is using a thumbnail quality photo. We want the full photo. To use this we need to make sure that we can save the original photo and display it instead.

    Saving a photo requires first generating a temp file and passing its URI to the photo intent.

    @@ -138,7 +138,7 @@

    Defining a provider

    Updating your gradle

    -

    You need to add compile 'com.android.support:support-v4:<version>' to your app's build.gradle file where <version> is set to your target SDK level.

    The specific file you want, as there are two build.gradle files, is the one that is annotated with "Module: app" in Android view or app/build.gradle in Project view.
    Your gradle will prompt you to sync, which can take a little while as it collects the appropriate files.

    +

    You need to add implementation 'com.android.support:support-v4:<version>' to your app's build.gradle file where <version> is set to your target SDK level.

    The specific file you want, as there are two build.gradle files, is the one that is annotated with "Module: app" in Android view or app/build.gradle in Project view.
    Your gradle will prompt you to sync, which can take a little while as it collects the appropriate files.

    Updating your manifest

    Next, you need to modify your manifest to indicate that your app will be sharing files. To do this add the following snippet to your manifest under application. Don't forget to update the authorities!

    <provider
    @@ -172,7 +172,7 @@ 

    But wait, didn't we say we'd change that text, too?

    - +

    So that was a long one! Taking and saving photos in Andorid can be a bit complex as there's a lot to control. Luckily Android provides some easy ways for us to have the OS take care of a lot of the details for us. The big take homes are: