10 Dec Introduction to Android App development (Devoxx 2011)
Posted at 13:16h
This session started with an explanation of what android is and how it was built.
Android is a platform developed by open handset alliance.
The platform is built in different layers.
- Lowest layer based on linux used for hardware
- Top of linux libraries and android runtime
- Application framework
As you all know Android development is done in JAVA, but underneath this layer lies a code which is called “dex”.
When you want to run your app on an android phone, the class files will be converted into a dex file so it can be used on any android phone (depending on the apps requirements).
For each app we can reuse existing functionality and therefor a subset of java se is available and an android specific api.
Taking this into account we can do amazing things, but remember it’s just a phone.
So we cannot develop apps which need a massive amount of memory or space as this is limited on a phone. We also need to think about garbage collection.
How to start developing?
There are plugins for eclipse and emulators for testing. (http://www.android.com/ for more information on how to install the plugin)
How does an android project look like?
Some important files
Mail.xml : Describes content what to see
R.java : is the class file which is automatically generated when compiling your project. This file zwill be converted into dex code so your app can be used on an android device.
Android manifest file : this file cannot be better described as the property of the app. This file is read on installation, can prompt for access to allow connections to the internet, current location ,…
This file is also used on the android market to filter apps.
strings.xml : when displaying static fields, you create a variable here and refer to this var that will be used to display. (key-value pair)
When creating a new project, you have to create an Activity.java file. This is the root file which is called when the app is opened.
Layouts: you can create specific layouts for portrait or landscape mode.
Lifecycle of apps
Android has a set of rules to kill apps to free-up memory. So when developing apps we need to take in mind so “save” the state of our device before it will be flipped. When flipping your device, android will trigger the lifecycle so your state will be killed and if you haven’t saved the state it cannot be restored.
This is the databases used in android. Each app will have its own database.
Hope this helps you on your way to develop your first android app.
Author: Jeroen W.