Android Development self-study Notes (i): hello,world!_android

Source: Internet
Author: User

Android, is it too late to learn how to develop Android? The time to write this question is – June 15, 2014, and I will answer: "Not too late, Android can be at least 10 years active!" So I promised myself to start learning Android development from today.

To build the Android development environment, LORINNN uses a different development environment than most developers, LORINNN uses the Intellij+genymotion program, not for others, only for speed, for programming Jeek pursuit:)

In the link: IntelliJ idea + Android SDK + genymotion emulator to build the best Android development environment in this introduction I have outlined the creation of the Android project, A more detailed description of how to create and develop the first Android project is described in this article.

Create HelloWorld Project

Open IntelliJ Idea and choose Create New Project

Then select the Android-application Module on the left, and then fill in the project name and project location below and select the Android SDK version and click Next.

Then continue to fill in the Project Properties related section, and you need to be prompted:

Package name has started to recommend a case mix (previously it is not recommended for uppercase letters, it is estimated that Android is more and more, with only the lowercase letter flag Package name is not enough). If there is a example in the primary domain section in Package name, it is not submitted to the Google Play app market, so if you have plans to submit applications to the application market, replace the example. Also target device select Show Device Chooser Dialog

The final step is to choose Finish, then the source interface of the following figure appears.

Modify Code

To analyze MyActivity code:


  
   
   
Copy Code code as follows:
Package Com.example.HelloWorld; Import android.app.Activity; Import Android.os.Bundle; The public class MyActivity extends activity { /** * called the "when" is the "activity" is the. * * @Override public void OnCreate (Bundle savedinstancestate) { super.oncreate (savedinstancestate); Setcontentview (R.layout.main); }

Setcontentview (R.layout.main) This function specifies that the activity uses the layout file as main, so we find the layout file:

Back to the left file directory navigation, find the layout subdirectory under Res, the Main.xml under the subdirectory is the object we are looking for.

Double-click the file and IntelliJ shows us the layout of the XML file, which is displayed in a similar way to the phone screen:

But let's switch to text mode first, to see what the content of this file is, this layout file shows all the content there is a label called TextView is that we are more concerned about, I have changed it to a red border around the content:

Start simulator

After everything has been modified from the default source code, we start the simulator and we delay it, click on the red button on the IntelliJ toolbar, as shown in the following figure, which shows the two emulators I've created (if you've never created one, you can click the New button on the right side of the dialog box), I select the top Nexus model and click the Start button on the right side of the dialog to start the simulator.

Waiting for the simulator to start, start running the program, excited not ~ ~ Click on the IDE toolbar robot behind the green Triangle, will appear below the Choose Device dialog box, select and click OK, the program automatically uploaded to the simulator.

This program will automatically run, and there is this we have modified the interface Oh.

Android development is not very simple, keep motivation to continue to learn OH.

Related Article

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.