Table of Contents
1. What is Android?
1.1. The Android operating system
1.2. Task
1.3. Android platform components
1.4. Google Play
2. Android Development Tools
2.1. Android SDK
2.2. Android debug bridge (adb)
2.3. Gradle and the Android plug-in for Gradle
2.4. Android Developer Tools and Android Studio
2.5. Android RunTime (ART)
2.6. How to develop Android applications
2.7. Conversion process from source code to Android application
3. Installation of Android Studio
3.1. System requirements
3.2. Requirements for using Linux
3.3. Download Android Studio
3.4. Installation of Android Studio
3.5. Configuration
4. Android SDK Manager
4.1. Using the Android SDK manager
4.2. Open the Android SDK manager in Android Studio
4.3. Install selected Android version or library
4.4. Install support library
5. Using Eclipse for Android development
6. Using Android Virtual Devices or real devices for testing
6.1. Android emulator and Android Virtual Device
6.2. Debug certificate and expire date
6.3. Android device emulator shortcuts
6.4. Google vs. Android AVD
6.5. Speed optimization with GPU rendering
6.6. Speed optimization with the Intel system image
6.7. Genymotion as alternative emulator
6.8. Using a real Android device for testing
7. Exercise: Getting started with Android Studio
7.1. Target
7.2. Create a new Android project
7.3. Review the generated project
7.4. Create a virtual device (AVD)
7.5. Start your virtual device
7.6. Start the application on your virtual device
8. Parts of an Android application
8.1. Android application
8.2. Android software components
8.3. Application
8.4. Activity
8.5. BroadcastReceiver
8.6. Service
8.7. ContentProvider
8.8. Context
9. Base user interface components in Android
9.1. Activities
9.2. Fragments
9.3. Views and layout manager
10. Other important Android elements
10.1. Home screen and lock screen widgets
10.2. Live Wallpapers
11. The Android manifest
11.1. Configuration of your Android application
11.2. Declaring components in the manifest file
11.3. Permissions
11.4. Android manifest example
12. More details of the Android manifest
12.1. Version and package
12.2. Application and components
12.3. Minimum and target SDK
12.4. Permissions
12.5. Required device configuration
12.6. Installation location
12.7. More info
13. Resources
13.1. Resource files
13.2. Example: Defining strings, string arrays, colors and dimensions
13.3. Resource qualifiers
13.4. Resource IDs and R.java
13.5. Good practices for resources IDs
13.6. System resources
14. Layout resource files
14.1. Activities and layouts
14.2. XML layout files
14.3. Defining IDs
14.4. Good practice: Predefined IDs via a separate file
14.5. Performance considerations with layouts
15. Android views - UI Widgets
16. Layout Manager and ViewGroups
16.1. Using a layout manager
16.2. Layout attributes
16.3. FrameLayout
16.4. LinearLayout
16.5. RelativeLayout
16.6. GridLayout
16.7. ScrollView
17. Exercise: Use layouts and view interaction
17.1. Review generated layout file
17.2. Adjust layout
17.3. Validate layout
17.4. Implement button behavior in your activity
17.5. Validate button interaction
17.6. Display text from your EditText field
17.7. Validate popup message
18. Exercise: Influence view layout at runtime
18.1. Target of this exercise
18.2. Add radio group and radio buttons to your layout
18.3. Change radio group orientation dynamically
18.4. Validating
19. Exercise: Create a temperature converter
19.1. Demo application
19.2. Create Project
19.3. Create attributes
19.4. Creating the layout
19.5. Edit view properties
19.6. Create utility class
19.7. Change the activity code
19.8. Start the application
20. Using Resources
20.1. References to resources in code
20.2. Accessing views from the layout in an activity
20.3. Reference to resources in XML files
20.4. Reference to Android system resources in XML files
21. Assets
21.1. Whats are assets?
21.2. Accessing assets
22. Exercise: Using resources in XML files and in code
22.1. Add images to your application
22.2. Add views to your project
22.3. Assign image to your image view
22.4. Replace images via button click
22.5. Validating
23. Exercise: Using ScrollView
24. Deployment
24.1. Overview
24.2. Defining software and hardware requirements for the application
24.3. Signing your application for the release
24.4. Export your application via Android Studio
24.5. Export your application via the Eclipse IDE
24.6. Via external sources
24.7. Google Play (Market)
25. References
25.1. Create an image via Android studio
25.2. Creating a resource folder
25.3. Creating a resource file
25.4. Add a new menu XML resource
25.5. Remove the usage of the support library
26. About this website
27. Links and Literature
27.1. Android online resources
27.2. vogella GmbH training and consulting support
1. What is Android?
1.1. The Android operating system
Android is an operating system based on the Linux kernel. The project responsible for developing the Android system is called the Android Open Source Project (AOSP) and is primarily lead by Google.
The Android system supports background processing, provides a rich user interface library, supports 2-D and 3-D graphics using the OpenGL-ES (short OpenGL) standard and grants access to the file system as well as an embedded SQLite database.
An Android application typically consists of different visual and non visual components and can reuse components of other applications.
1.2. Task
In Android the reuse of other application components is a concept known as task. An application can access other Android components to achieve a task. For example, from a component of your application you can trigger another component in the Android system, which manages photos, even if this component is not part of your application. In this component you select a photo and return to your application to use the selected photo.
Such a flow of events is depicted in the following graphic.
Defining an Android tasks
1.3. Android platform components
The Android system is a full software stack, which is typically divided into the four areas as depicted in the following graphic.
Android software layers
The levels can be described as:
Applications - The Android Open Source Project contains several default application, like the Browser, Camera, Gallery, Music, Phone and more.
Application framework - An API which allows high-level interactions with the Android system from Android applications.
Libraries and runtime - The libraries for many common functions (e.g.: graphic rendering, data storage, web browsing, etc.) of the Application Framework and the Dalvik runtime, as well as the core Java libraries for running Android applications.
Linux kernel - Communication layer for the underlying hardware.
The Linux kernel, the libraries and the runtime are encapsulated by the application framework. The Android application developer typically works with the two layers on top to create new Android applications.
1.4. Google Play
Google offers the Google Play service, a marketplace in which programmers can offer their Android applications to Android users. Customers use the Google Play application which allows them to buy and install applications from the Google Play service.
Google Play also offers an update service. If a programmer uploads a new version of his application to Google Play, this service notifies existing users that an update is available and allows them to install the update.
Google Play provides access to services and libraries for Android application programmers, too. For example, it provides a service to use and display Google Maps and another to synchronize the application state between different Android installations. Providing these services via Google Play has the advantage that they are available for older Android releases and can be updated by Google without the need for an update of the Android release on the phone.
2. Android Development Tools
2.1. Android SDK
The Android Software Development Kit (Android SDK) contains the necessary tools to create, compile and package Android applications. Most of these tools are command line based. The primary way to develop Android applications is based on the Java programming language.
2.2. Android debug bridge (adb)
The Android SDK contains the Android debug bridge (adb), which is a tool that allows you to connect to a virtual or real Android device, for the purpose of managing the device or debugging your application.
2.3. Gradle and the Android plug-in for Gradle
The Android tooling uses Gradle as build system. The Android team provides a Gradle plug-in for build Android applications which is entered in the build.gradle file in the top root of the Android project. It typically looks like the following, please note that the version might be different in your case.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
You find the available versions of this plug-in under the following URL: Available Android Gradle plug-in versions.
2.4. Android Developer Tools and Android Studio
Google provides an IDE called Android Studio as the preferred development environment for creating Android applications. This IDE is based on the IntelliJ IDE.
The Android tools provide specialized editors for Android specific files. Most of Android's configuration files are based on XML. In this case these editors allow you to switch between the XML representation of the file and a structured user interface for entering the data.
This description uses Android Studio as IDE.
2.5. Android RunTime (ART)
Android 5.0 uses the Android RunTime (ART) as runtime for all Android applications.
ART uses Ahead Of Time compilation. During the deployment process of an application on an Android device, the application code is translated into machine code. This results in approx. 30% larger compile code, but allows faster execution from the beginning of the application.
This also saves battery life, as the compilation is only done once, during the first start of the application.
The dex2oat tool takes the .dex file created by the Android tool change and compiles that into an Executable and Linkable Format (ELF file). This file contains the dex code, compiled native code and meta-data. Keeping the .dex code allows that existing tools still work.
The garbage collection in ART has been optimized to reduce times in which the application freezes.
2.6. How to develop Android applications
Android applications are primarily written in the Java programming language.
During development the developer creates the Android specific configuration files and writes the application logic in the Java programming language.
The Android tooling converts these application files, transparently to the user, into an Android application. When developers trigger the deployment in their IDE, the whole Android application is compiled, packaged, deployed and started.
2.7. Conversion process from source code to Android application
The Java source files are converted to Java class files by the Java compiler.
The Android SDK contains a tool called dx which converts Java class files into a .dex (Dalvik Executable) file. All class files of the application are placed in this .dex file. During this conversion process redundant information in the class files are optimized in the .dex file.
For example, if the same String is found in different class files, the .dex file contains only one reference of this String.
These .dex files are therefore much smaller in size than the corresponding class files.
The .dex file and the resources of an Android project, e.g., the images and XML files, are packed into an .apk (Android Package) file. The program aapt (Android Asset Packaging Tool) performs this step.
The resulting .apk file contains all necessary data to run the Android application and can be deployed to an Android device via the adb tool.
3. Installation of Android Studio
3.1. System requirements
Development for Android can be done on a reasonably sized computer. For a nice experience a modern computer is recommended, for example, a 2.6 GHz CPU with at least 8 GB of memory. An SSD speeds up the start of the Android emulator significantly.
3.2. Requirements for using Linux
The Android SDK is 32-bit, therefore on a 64-bit Linux system you need to have the package ia32-libs installed. For Ubuntu you can do this via the following command.
apt-get install ia32-libs
Please check your distribution documentation if you are using a different flavor of Linux.
On Ubuntu 13.04 you also have to install the OpenGL support. This can be done on Ubuntu 13.04 via following command.
# install OpenGL support
sudo apt-get install libgl1-mesa-dev
Please check your distribution documentation if you are using a different flavor of Linux.
3.3. Download Android Studio
Download Android Studio from the Android Studio website. The download comes in two flavors, SDK Tools only and Android Studio Packages. You want to download the Android Studio Package for your operation system.
Installation of Android Studio
Post A Comment: