Andriod programming – Posts 1: Hello World

Hello everyone, starting from today I will write the series Android programming guide a basically they have the most experience. Although previously, but also had to write and find themselves not meet with your approach, so I decided to rewrite from scratch and selective, retain what's needed the previous post. I'll try to write how you easy to learn as possible, as their time directly on the class lecture.

[qads]

1. What is Programming?

Ask this question to many of you perhaps you laughing pale, but I still question here, because his writing is not for you to know programming, but also for those you do not know what programming is.

Programming

  • Programming under its definition it is a creative process to instruct the computer to do a specific job. It looks just like the teaching process of teachers to students, student, so when you program, you are the teacher – teacher machinery to do the job that you want to own.
  • Android programming is creative process to how you teach your Android phone you do a certain job through a series of commands are summed up in one application. Which means you write the command line – like writing but in a syntax, certain standard rules to create an application that serves the job you need to do.

2. What needs to learn programming Android

To learn programming android you need the basics behind:

  • Knowing the basics of Java. Currently Android uses the Java language to write commands, so you should know the basics of it.
  • There is a computer with 4 GB or more RAM, Core I3 or more. If configured lower still doable but will slow treadmill offensive in the process of learning and work.

3. Installation tool

B1: Install JDK. JDK is the environment so that we can use Android Studio. You Click here to download and install.

B2: Install Android studio. Days prior to programming Android, we used Eclipse, but now it has been “forsake” and now we are using Android Studio. The homepage you to download the normal settings. Maybe take some time and that your. https://developer.android.com/studio/index.html

B3 (Optional): Android programmers must have an Android phone to run instead. If you have an Android phone to run it too good, even if there is no system in Android Studio is available for you to use virtual machines. Also you can install genymotion (See here Posts or video tutorials) because I felt it run faster virtual machine system available.

B4 (Optional): Moreover, if using windows that want to connect to your phone is to launch apps, the support you need drivers for your phone line. Google.com you look for drivers on the phone with your application and install on your computer is ok. (Example: Driver samsung galaxy J5 for windows).

Hope you can install everything successfully. Since we can not see and guide you directly to your installation can only guide you to write that's all.

4. Create the first Android app – Hello world

Now it's time we started writing the first application and then, Hello World application (Hello world).

In this article, their use Android Studio 2.1.2 the current latest.

The more you open Android Studio will look as follows:start-android-studio

You click to create a new Project offline. We will continue like this.

create-project-android

Here your attention 4 following:

  • Project name: is the name of your project, you should (right) placed under the Java naming rules. Ie not sign and immediately wrote the first letter of each word is capitalized.
  • Domain: it is your choice, but it named companies, Your name or the name Team
  • Package name: This is the code of the application, each application has a unique code and can not overlap. Once uploaded to the Play store, it does not begin with example. Normally it would take domain names connected to the project, but you can correct by pressing the Edit button on the right.
  • Project location: Save your position in Computer Project. You should put in drive D, And – where you install the operating system, the data is not lost.

Already, click Next and continue.

select-app-type

Here you can select the type of volume application is for phone and tablet, or wear (clock), Television, Glass (glass android). Of course we will pick the first one is for phone. Click Next and continue.

select-activity-type

Here we can choose the type of interface for the app opens, called Activity. Later he would say more about Activity and now you can take your pick “Empty Activity” – Null interface has.

Next, click Next and name Activity, here we are 2 generated file, 1 Java file handling code is event, data and 1 xml file to design the interface. By default, you just leave and click Next.set-activity-name

After finishing next, Android Studio will handle creation for our Project. The process can take a while depending on the machine, but average about 10-20s is finished. And we have the following screen.

 

android-app

On the left is the frame structure of our Project, on the right is the code editor. There currently are 2 MainActivity.java file is opened and activity_main.xml. File Java to write code events, Data, xml file to design your interfaces as discussed above. Now you can click the Run button to run your application. After running applications, the program will ask you to select telephone truth (if you connect) or open the virtual machine, you choose to follow, depending on what you have.

After running up, we will see phones (real or virtual) running apps, screen has the word Hello world.

hello-world-android

If the file you open in tabs activity_main.xml can design the blueprints see our interface is the same as when running the application on.

android-app-layout

That's it, hope you can start all easily Hello world. Any questions suggestions please comment below the article.