Saturday, February 20, 2016

How to build your Android app

How to build your first Android app application .apk. You’ll learn how to create an Android project and run a debuggable version of the app. You'll also learn some fundamentals of Android app design, including how to build a simple user interface and handle user input.

Before you start this class, be sure you have your development environment set up. You need to:

    Download Android Studio.
    Download the latest SDK tools and platforms using the SDK Manager.

Note: Although most of this training class expects that you're using Android Studio, some procedures include alternative instructions for using the SDK tools from the command line instead.

This class uses a tutorial format to create a small Android app that teaches you some fundamental concepts about Android development, so it's important that you follow each step.

An Android project contains all the files that comprise the source code for your Android app.

This lesson shows how to create a new project either using Android Studio or using the SDK tools from a command line.

Note: You should already have the Android SDK installed, and if you're using Android Studio, you should also have Android Studio installed. If you don't have these, follow the guide to Installing the Android SDK before you start this lesson.
Create a Project with Android Studio

    In Android Studio, create a new project:
        If you don't have a project opened, in the Welcome screen, click New Project.
        If you have a project opened, from the File menu, select New Project. The Create New Project screen appears.
    Fill out the fields on the screen, and click Next.

    It is easier to follow these lessons if you use the same values as shown.
        Application Name is the app name that appears to users. For this project, use "My First App."
        Company domain provides a qualifier that will be appended to the package name; Android Studio will remember this qualifier for each new project you create.
        Package name is the fully qualified name for the project (following the same rules as those for naming packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. You can Edit this value independently from the application name or the company domain.
        Project location is the directory on your system that holds the project files.
    Under Select the form factors your app will run on, check the box for Phone and Tablet.
    For Minimum SDK, select API 8: Android 2.2 (Froyo).

    The Minimum Required SDK is the earliest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions).
    Leave all of the other options (TV, Wear, and Glass) unchecked and click Next.
    Activities

    An activity is one of the distinguishing features of the Android framework. Activities provide the user with access to your app, and there may be many activities. An application will usually have a main activity for when the user launches the application, another activity for when she selects some content to view, for example, and other activities for when she performs other tasks within the app. See Activities for more information.
    Under Add an activity to <template>, select Blank Activity and click Next.
    Under Customize the Activity, change the Activity Name to MyActivity. The Layout Name changes to activity_my, and the Title to MyActivity. The Menu Resource Name is menu_my.
    Click the Finish button to create the project.
*source: http://developer.android.com/training/basics/firstapp/index.html

No comments:

Post a Comment