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 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:
You click to create a new Project offline. We will continue like this.
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.
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.
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.
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.
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.
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.
That's it, hope you can start all easily Hello world. Any questions suggestions please comment below the article.
I have set as a guideline, but until you play it fails “Unable to start the Genymotion virtual device
VirtualBox can’t run the virtual device
Try to run the virtual device directly from VirtualBox to check for issues
Check the log files for more inforation. For this, refer to:
https://www.genymotion.com/legacy-support/faq.html#collapse-logs“. I also tried to reinstall but erasing the error still shows that sir.
You see how this test:
Select yourVM -> Settings -> Network -> Disable the Network Adapter (It will be re-configured by Genymotion)
His error when creating a new project , you are just another way for her to DC ko dùm. I wonder what school should be more fluent yet
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
———————–
Error occurred during initialization of VM
Could not reserve enough space for 1572864KB object heap
It reported insufficient memory you must. You see there was this Android installed drive is not offline. If it is full, then you switch to another drive
start learning from this article. hì
Physicians for little children ask about webview: 1. suppose ourselves in youtube via WebView, watch a video, how to watch full-screen video. 2. When you rotate the screen, then it reloads homepage, how to watch streaming video when you rotate the screen ạ. wish the pro help me sir.
ps. Kids use YouTube to test video for fast so I did not use youtube api, My purpose is to see video on any website. Thank you sir
When watching videos on webview will have 1 buttons let you zoom in the screen. As for it being reloaded the page, I have not tried, you look in here, please. http://stackoverflow.com/questions/12131025/android-preventing-webview-reload-on-rotate
How to programming on the phone so a
Learning in this series that may have too.
Cám ơn bạn vì bài viết
Mặc dù kiến thức cơ bản nhưng hãy cứ đi từ nơi bắt đầu. Đúng nhỉ? 🙂
Thầy ơi cho em hỏi. Là em cài đặt xong rồi. Nhưng em thử chạy điện thoại không chạy lên được giao diện với chữ Hello world như trên. Em không biết bị lỗi gì nữa. Mong thầy giúp em. Em cám ơn.
Cái này bạn check logcat xem báo gì, rồi hỏi trực tiếp ai đó quá fb sẽ nhanh hơn. The article I wrote instructions should answer the error when you run a bit of feedback, time is also not fixed.