This should be a very short (beginner) introduction/tutorial how to create a mobile app for Android. The tutorial is based on API Level 17 and Android 4.2 (Jelly Bean). Our goal is to start from scratch and have at the end a mp/h to km/h converter.
1. What do you need:
- Basic XML knowledge
- Basic Java knowledge
- Basic Eclipse knowledge
- 2h of your time
2. Prerequisites:
- Before you can start you need the Android SDK and a IDE. Android offers a special bundle for that: Android SDK Bundle
- Download the bundle, unzip and run the “SDK Manager.exe”.
- start Eclipse
3. Create a Android virtual machine (dalvik):
To run, test and debug your Application you can create and run a virtual android machine on your computer. Later you can deploy your Application to this virtual machine.
- Click on “Windows” at the navigation toolbar
- Open “Android Virtual Device manager“
Create a “New” Virtual Device:
Be sure that “Use Host GPU” is enabled. This allows the AVD to use the Host GPU and this helps to render the AVD much faster.
After that you can start the AVD:
4. Create a new Project:
- Open “File“
- “New“
- “Android Application Project“
Choose a new for your Project:
Configure Project:
Configure Launcher Icon:
Here you can choose a Launcher Icon that will be displayed on your mobile phone.
Create a new Activity:
Configure your Activity:
After finishing Eclipse looks similar to that:
5. Implement the Look & Feel:
- Navigate in the package explorer to “/res/layout/” and open “activity_main.xml“
- Right-click on “Hello World” and delete
5.1 Create static Attributes:
- Select “/res/values/strings.xml“
Add a few more String(!) Attributes:
- Name/value: “miles” / “to Miles“
- Name/value: “kmh” / “to km/h“
- Name/value: “calc” / “Calculate“
Switch from “Resources” to “strings.xml” and make sure that your code look similar to that snippet
- <resources>
- <string name="app_name">TutorialApplication</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <color name="myColor">#eeeeee</color>
- <string name="miles">to Miles</string>
- <string name="kmh">to km/h</string>
- <string name="calc">Calculate</string>
- </resources>
5.2 Add Views
- Select “/res/layout/activity_main.xml“
- Open Android editor via double-click
You have two possibilities. You can create new Views via drag and drop or you can edit the XML source code. In this tutorial we add the Views via drag and drop 
So let’s start building our App. At first we have to add a “Text Field” for the input.
Thank you review the site!
ScopeReview
0 comments:
Post a Comment