As a small developer, I usually write source code and any products, but today I want you simultaneously illustrate my work and make you a small task. In my guide I will show you how you can program your first application for Android, and all without prior knowledge.
If you already have previous knowledge of a programming language, which is helpful, but it is absolutely not necessary for understanding. Do not worry, I lead you through the steps. Developing for Android takes place mainly in Java, a language that is taught in many programming courses and at many universities. If Java is new to you, but you have other programming experiences have collected, you can easily to learn Java.
The aim of our little project will be to write an app that displays "Brilliant, I can" on the screen of your android. As a development environment, we will use Android Studio, which was presented at the Google developer conference I / O 2013.
If you already doesnt: (train your brain)
Ask friends, Google or whoever. Some difficulties in learning in a group, while others are lone Riders. To be able to program successfully, you should definitely consider primarily once completely alone with it. Compile issues and thus go to an experienced programmer to clean all outstanding issues.
First, you must download and install Android Studio. The development environment is available free of charge. As a developer, I use Linux, but a version for Windows and Mac is also available. On the website there are detailed instructions for each installation.
Android Studio is written in Java, and we want to write in Java, you must also specify the Java development tools JDK (Java Development Kit) in case your not already have it. We use Oracle JDK7.
We will invite our finished app directly on your smartphone. This requires that your device is enabled on USB debugging. The corresponding setting is found in the developer options of system settings. Over the phone you can enable the developer options by tapping on your build number seven times. Then you can tick the USB debugging.
Your First Project
After you have Android Studio installed and prepared your smartphone, you can start with your first project. In addition you will select in Android Studio New Project. Our project is called "Brilliant, I can," what you can subscribe right under Application name. Fields Module name and Project Location to be filled automatically and you must not change this.
However, under the minimum required SDK SDK, this sets the value to 15. This means that you ignore Android 2.3 (API 8). I am aware that this version of Android currently still has 26 percent market share, but after Christmas could already change quickly. If you are interested in the distribution of the various versions of Android, you can read to your heart's content on the internet after more.
Under Target SDK provides your API 19: Android 4.4 (KitKat) and under LanguageLevel you choose either Java 6 or Java 7 from. Then you kllickt Next.
Since we do not use a custom icon, you can in the next window remove the corresponding hook and engages Next to the following window.
There is nothing to adjust. Click Next again and you see this window.
Again, you have to make any changes, because we are almost done, so click only once on Finish. After all these steps will ensure that your Android smartphone is connected via USB to the computer and USB debugging enabled you what you symbolizes a small icon in the status bar.
Then you can simply click the green play button in the top bar of Android Studio click. The automatically generated code is compiled, transferred to your device and executed there.
If all goes well, your app is now running on your smartphone and shows "xxxxxx" on. A Xxxxx program is typically one of the easiest in a programming language, and is usually used for the demonstration. But we do not just want the world to say hello, but also you.
Now it's down to business, you just created to the adjustment of your app: Android Studio links in a kind of tree is shown with folders and contents. Find the res folder. This is a values-folder in which there is the strings.xml file.
If you click it, you should see a string in the right pane, stands in the "Xxxxx". Here carries your "Brilliant, I can" field. Click again on the green play button the app will run on your Android again and you should be able to see the effect of changing directly.
Location: Brilliant, I can
Localization (usually referred to as l10n) is getting more and more important. Software should be available not only in English, including Google wants to reach the next billion with Android.
I myself come from Osaka in Japan, I live in Austria and speak every day at work in English and Portuguese. We will tell our application so in three languages "Whatever".
If you look at the values of your project folder, you will find there a strings.xml file. To support additional languages, you have to add your your res folder other country-specific values folder. In our case, the values-pt (for Portuguese) and values-de (for German). Now you can copy the file strings.xml from the default folder via copy-paste into the other two folders. The content should of course be adjusted, so we write "Brilliant, I can do it" in the strings.xml the German folder and "Incrível, eu posso" in the Portuguese.
According to your system language You should now get the right message appears if your running on the play button, the app again on your device. More information about the localization of Android apps can be found
Of course complicated apps require more complex source code, but once everyone starts with "xxxxxx" on. I hope I was able to arouse your interest for the development of Android apps. If you enjoyed this guide, please let us know in the comments, and maybe have been engaged in the next time with more complicated tasks.