"Lushengduan" 01, build the Android app development environment programming program HelloWorld

Source: Internet
Author: User

First, build the development environment

1. JDK Environment variables

JDK Download

Link: http://pan.baidu.com/s/1gen1o9l Password: 8fko

Open Computer-Properties-Advanced system settings-environment variables, new JAVA_HOME system environment variables

C:\Program Files\java\jdk1. 7. 0_80

New CLASSPATH System environment variable

.; %java_home%lib;%java_home%lib\tools.jar;

Append to System environment variable path

;%java_home%/bin; C:\Program Files\java\jre7\bin

2. Install Android Studio

Link: http://pan.baidu.com/s/1mgrc7wk Password: mqn8

After the installation is complete, open Android Studio, before having the studio configuration of the first choice, this article we choose a second

Next follow the prompts, the process will be networked download/update the SDK, when finished click "Finish", Studio installed successfully

II. Preparation of the procedure HelloWorld

Open Android Studio, we select "Start a new Android studio project"

Change the name of the program to HelloWorld, and the second line remains the default (it's best to customize it so you don't have to repeat it with someone else's package name)

Tick "phone and Tablet", then select the SDK version, here Select "4.0.3", currently equipped with more than 4.0 version of the mobile phone is more than 90%, so it is compatible with most devices

Select "Add No Activity", we intend to write a helloworldactivity, do not use the default activity, click "Finish", this step will be connected to download some of the necessary things, please wait a moment to enter the studio main interface

OK, we can start to write our HelloWorld, to present a mobile phone can see the interface, we must write a class inherit from activity, the name of the class is named Helloworldactivity; in the Java directory, by right-clicking on the contents of the red box, New--java class to create our classes

After clicking "OK", enter the following code in the Helloworldactivity class

 PackageCom.example.lushengduan.helloworld;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.widget.TextView;/*** Created by Lushengduan on 2016/3/4.*/ Public classHelloworldactivityextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); TextView TextView=NewTextView ( This); Textview.settext ("Helloworld!");    Setcontentview (TextView); }}

Open Androidmanifest.xml, modify its contents to the following code

<Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.lushengduan.helloworld">    <ApplicationAndroid:allowbackup= "true"Android:icon= "@mipmap/ic_launcher"Android:label= "@string/app_name"Android:supportsrtl= "true"Android:theme= "@style/apptheme">        <ActivityAndroid:name=". Helloworldactivity ">            <Intent-filter>                <ActionAndroid:name= "Android.intent.action.MAIN"/>                <categoryAndroid:name= "Android.intent.category.LAUNCHER"/>            </Intent-filter>        </Activity>    </Application></Manifest>

To create a new Android emulator or plug in your phone, click the run--"Run App" on the menu bar to start running the program with the following results:

At this point, our HelloWorld application is complete!!

"Lushengduan" 01, build the Android app development environment Program HelloWorld

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.