- GUI
- Windows API tutorial
- Introduction to Windows API
- Windows API main functions
- System functions in Windows API
- Strings in Windows API
- Date & time in Windows API
- A window in Windows API
- First steps in UI
- Windows API menus
- Windows API dialogs
- Windows API controls I
- Windows API controls II
- Windows API controls III
- Advanced controls in Windows API
- Custom controls in Windows API
- The GDI in Windows API
- PyQt4 tutorial
- PyQt5 tutorial
- Qt4 tutorial
- Introduction to Qt4 toolkit
- Qt4 utility classes
- Strings in Qt4
- Date and time in Qt4
- Working with files and directories in Qt4
- First programs in Qt4
- Menus and toolbars in Qt4
- Layout management in Qt4
- Events and signals in Qt4
- Qt4 Widgets
- Qt4 Widgets II
- Painting in Qt4
- Custom widget in Qt4
- The Breakout game in Qt4
- Qt5 tutorial
- Introduction to Qt5 toolkit
- Strings in Qt5
- Date and time in Qt5
- Containers in Qt5
- Working with files and directories in Qt5
- First programs in Qt5
- Menus and toolbars in Qt5
- Layout management in Qt5
- Events and signals in Qt5
- Qt5 Widgets
- Qt5 Widgets II
- Painting in Qt5
- Custom widget in Qt5
- Snake in Qt5
- The Breakout game in Qt5
- PySide tutorial
- Tkinter tutorial
- Tcl/Tk tutorial
- Qt Quick tutorial
- Java Swing tutorial
- JavaFX tutorial
- Java SWT tutorial
- wxWidgets tutorial
- Introduction to wxWidgets
- wxWidgets helper classes
- First programs in wxWidgets
- Menus and toolbars in wxWidgets
- Layout management in wxWidgets
- Events in wxWidgets
- Dialogs in wxWidgets
- wxWidgets widgets
- wxWidgets widgets II
- Drag and Drop in wxWidgets
- Device Contexts in wxWidgets
- Custom widgets in wxWidgets
- The Tetris game in wxWidgets
- wxPython tutorial
- Introduction to wxPython
- First Steps
- Menus and toolbars
- Layout management in wxPython
- Events in wxPython
- wxPython dialogs
- Widgets
- Advanced widgets in wxPython
- Drag and drop in wxPython
- Internationalisation
- Application skeletons in wxPython
- The GDI
- Mapping modes
- Creating custom widgets
- Tips and Tricks
- wxPython Gripts
- The Tetris game in wxPython
- C# Winforms Mono tutorial
- Java Gnome tutorial
- Introduction to Java Gnome
- First steps in Java Gnome
- Layout management in Java Gnome
- Layout management II in Java Gnome
- Menus in Java Gnome
- Toolbars in Java Gnome
- Events in Java Gnome
- Widgets in Java Gnome
- Widgets II in Java Gnome
- Advanced widgets in Java Gnome
- Dialogs in Java Gnome
- Pango in Java Gnome
- Drawing with Cairo in Java Gnome
- Drawing with Cairo II
- Nibbles in Java Gnome
- QtJambi tutorial
- GTK+ tutorial
- Ruby GTK tutorial
- GTK# tutorial
- Visual Basic GTK# tutorial
- PyGTK tutorial
- Introduction to PyGTK
- First steps in PyGTK
- Layout management in PyGTK
- Menus in PyGTK
- Toolbars in PyGTK
- Signals & events in PyGTK
- Widgets in PyGTK
- Widgets II in PyGTK
- Advanced widgets in PyGTK
- Dialogs in PyGTK
- Pango
- Pango II
- Drawing with Cairo in PyGTK
- Drawing with Cairo II
- Snake game in PyGTK
- Custom widget in PyGTK
- PHP GTK tutorial
- C# Qyoto tutorial
- Ruby Qt tutorial
- Visual Basic Qyoto tutorial
- Mono IronPython Winforms tutorial
- Introduction
- First steps in IronPython Mono Winforms
- Layout management
- Menus and toolbars
- Basic Controls in Mono Winforms
- Basic Controls II in Mono Winforms
- Advanced Controls in Mono Winforms
- Dialogs
- Drag & drop in Mono Winforms
- Painting
- Painting II in IronPython Mono Winforms
- Snake in IronPython Mono Winforms
- The Tetris game in IronPython Mono Winforms
- FreeBASIC GTK tutorial
- Jython Swing tutorial
- JRuby Swing tutorial
- Visual Basic Winforms tutorial
- JavaScript GTK tutorial
- Ruby HTTPClient tutorial
- Ruby Faraday tutorial
- Ruby Net::HTTP tutorial
- Java 2D games tutorial
- Java 2D tutorial
- Cairo graphics tutorial
- PyCairo tutorial
- HTML5 canvas tutorial
- Python tutorial
- Python language
- Interactive Python
- Python lexical structure
- Python data types
- Strings in Python
- Python lists
- Python dictionaries
- Python operators
- Keywords in Python
- Functions in Python
- Files in Python
- Object-oriented programming in Python
- Modules
- Packages in Python
- Exceptions in Python
- Iterators and Generators
- Introspection in Python
- Ruby tutorial
- PHP tutorial
- Visual Basic tutorial
- Visual Basic
- Visual Basic lexical structure
- Basics
- Visual Basic data types
- Strings in Visual Basic
- Operators
- Flow control
- Visual Basic arrays
- Procedures & functions in Visual Basic
- Organizing code in Visual Basic
- Object-oriented programming
- Object-oriented programming II in Visual Basic
- Collections in Visual Basic
- Input & output
- Tcl tutorial
- C# tutorial
- Java tutorial
- AWK tutorial
- Jetty tutorial
- Tomcat Derby tutorial
- Jtwig tutorial
- Android tutorial
- Introduction to Android development
- First Android application
- Android Button widgets
- Android Intents
- Layout management in Android
- Android Spinner widget
- SeekBar widget
- Android ProgressBar widget
- Android ListView widget
- Android Pickers
- Android menus
- Dialogs
- Drawing in Android
- Java EE 5 tutorials
- Introduction
- Installing Java
- Installing NetBeans 6
- Java Application Servers
- Resin CGIServlet
- JavaServer Pages, (JSPs)
- Implicit objects in JSPs
- Shopping cart
- JSP & MySQL Database
- Java Servlets
- Sending email in a Servlet
- Creating a captcha in a Servlet
- DataSource & DriverManager
- Java Beans
- Custom JSP tags
- Object relational mapping with iBATIS
- Jsoup tutorial
- MySQL tutorial
- MySQL quick tutorial
- MySQL storage engines
- MySQL data types
- Creating, altering and dropping tables in MySQL
- MySQL expressions
- Inserting, updating, and deleting data in MySQL
- The SELECT statement in MySQL
- MySQL subqueries
- MySQL constraints
- Exporting and importing data in MySQL
- Joining tables in MySQL
- MySQL functions
- Views in MySQL
- Transactions in MySQL
- MySQL stored routines
- MySQL Python tutorial
- MySQL Perl tutorial
- MySQL C API programming tutorial
- MySQL Visual Basic tutorial
- MySQL PHP tutorial
- MySQL Java tutorial
- MySQL Ruby tutorial
- MySQL C# tutorial
- SQLite tutorial
- SQLite C tutorial
- SQLite PHP tutorial
- SQLite Python tutorial
- SQLite Perl tutorial
- SQLite Ruby tutorial
- SQLite C# tutorial
- SQLite Visual Basic tutorial
- PostgreSQL C tutorial
- PostgreSQL Python tutorial
- PostgreSQL Ruby tutorial
- PostgreSQL PHP tutorial
- PostgreSQL Java tutorial
- Apache Derby tutorial
- SQLAlchemy tutorial
- MongoDB PHP tutorial
- MongoDB Java tutorial
- MongoDB JavaScript tutorial
- MongoDB Ruby tutorial
- Spring JdbcTemplate tutorial
- JDBI tutorial
Introduction to Android development
This is an introductory Android development tutorial. The purpose of this tutorial is to get you started with the development of applications in Android. The tutorial has been created and tested on Linux.
Android
Android is a Linux based operating system designed for mobile devices such as smartphones and tablet computers. It is also used for various networking equipment, smart TV systems, wrist watches and household appliances. Applications for Android are developed in a customised version of the Java programming language.
Android was developed in 2003 by a Californian company which was later purchased by Google. Google created the Android Open Source Project for maintaining and developing of the Android OS. Android is being developed quickly; new versions of Android are frequently being released. The Android code names are being choosed after some sweets, like Donut, Gingerbread, or Jelly Bean. Developers can publish their applications in an online Android market called Google Play. Before an application is published on a Google Play market, it must be prepared for release, properly versioned and digitally signed. Android users use a built-in application to search for applications on Android market and install them.
Android architecture
Android is based on a Linux kernel. The kernel is responsible for the device drivers, memory management, process management and networking. Above the kernel, there are core libraries and Android runtime. The libraries are C/C++ libraries that provide services such as data storage, screen display, multimedia and web browsing. These capabilities are exposed indirectly to developers through the Android application framework. The Android runtime consists of the Dalvik virtual machine and the core Java application libraries. Dalvik is a virtual machine specifically developed to run Java based applications on Android. It is different from the standard Java Virtual Machine (JVM). The next layer up is the application framework. It is a set of APIs to provide services to Android applications. It handles application life cycle through Activity Manager, notifications through Notification manager, resources through Resource Manager, a set of graphical widgets (called Views in Android), package management trough Package Manager and others. On top of it sits the applications layer. It is where our own applications are running. Android also has built-in applications which can provide additional services to our applications. We can have access to browser, SMS, calendars, maps or contacts.
Terms and concepts
Android application is an archive file with an .apk
suffix. Each Android application lives on its own in a security sandbox. An activity is a single screen with a user interface. An application can have one or more activities. Activities are independent of each other. Activities are subclasses of the Activity class. A service is an application component that runs in the background. It does long running operations. It is a subclass of a Service class. A content provider manages a shared set of application data. It is used to access & modify data in the filesystem, SQLite database or the web. It is a subclass of the ContentProvider class. A broadcast receiver is a component that receives broadcast notifications from the system or applications. A broadcast receiver is implemented as a subclass of a BroadcastReceiver
. Each broadcast is delivered as an Intent object. An intent is an asynchronous message. It is an abstract description of an operation to be performed. Intents are used to navigate through activities. Activities, services and broadcast receivers are activated through intents. A View
class is a basic building block of a user interface. It is responsible for drawing and event handling. A View is a base class for widgets, which are used to create UI components like buttons or check boxes. A ViewGroup
is an object that holds other View
(and ViewGroup
) objects in order to define the layout of the interface.
Each Android application must have an AndroidManifest.xml
file in the root directory. This file presents essential information about the application to the Android system. The API level is an integer value that uniquely identifies the framework API of the version of the Android platform. Each new Android platform brings new modifications to the Android application framework. An Emulator is a virtual mobile device that runs on a computer. It is used to develop and test Android applications without using a physical device. An Android Virtual Device (AVD) is an emulator configuration that models an actual physical device such as smartphone. We can create multiple AVDs and test our applications on different hardware platforms that use Android OS.
Installation
To start developing for Android, we need to download the Android SDK (Software Development Toolkit). There are two options. An Eclipse ADT bundle or single SDK tools. We will go with the latter.
$ ls -sh android-sdk_r21-linux.tgz 88M android-sdk_r21-linux.tgz
Currently the file to download for Linux is android-sdk_r21-linux.tgz
.
$ tar -xzvf android-sdk_r21-linux.tgz
We uncompress the zipped archive. The archive is extracted to the android-sdk-linux
directory.
$ pwd /home/janbodnar/bin/android-sdk-linux $ ls add-ons platforms SDK Readme.txt tools
The Android SDK archive initially contains only the basic SDK tools. We need to download additional tools with the SDK manager. The Android SDK manager is launched with the android
command line tool.

$ ls add-ons platforms samples sources temp docs platform-tools SDK Readme.txt system-images tools
These are the contents of the android-sdk-linux
directory after installing additional tools.
export PATH=$PATH:~/bin/android-sdk-linux/tools export PATH=$PATH:~/bin/android-sdk-linux/platform-tools
We add the tools and platform-tools directories to the PATH
variable.
Android AVD
The Android AVD (Android Virtual Device) is a is an emulator configuration that enables us to model an actual device by defining hardware and software options to be emulated by the Android Emulator.
$ android avd
The command starts the Android Virtual Device Manager.

Clicking on the New button we start a dialog to create a new Android Virtual Device. In the dialog we give the AVD a name, select a hardware profile of the device, choose the API level of the target or a dedicated storage area on our development machine.
$ android list avd Available Android Virtual Devices: Name: AVD3 Path: /home/janbodnar/.android/avd/AVD3.avd Target: Android 4.2 (API level 17) ABI: armeabi-v7a Skin: 320x480 --------- Name: AVD4 Path: /home/janbodnar/.android/avd/AVD4.avd Target: Android 4.2 (API level 17) ABI: armeabi-v7a Skin: 240x320
The android list avd
command shows all available Android Virtual Devices.
Android Emulator
The Android emulator is a virtual mobile device that runs on our computer. It lets us develop and test Android applications without using a physical device.
$ emulator -avd AVD1 &
We use the emulator command to start the emulator. We specify the name of the created Android Virtual Device.

The emulator is unlocked using the F2 key. To list available applications, we click on the circle icon. An application is uninstalled by clicking on the menu hardware button and selecting Manage apps option. Then we click on the icon of the application to uninstall and click the Uninstall button.
This chapter was an introduction Android application development.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论