The following notes are tutorials for Android. Full source code is included with each example. (Note: For an alternate organization for these tutorials, see Android Tutorials By Topic.)
- Two Progress Bars for Android - This demo app shows how to build horizontal and vertical progress bars.
- Drag-Drop for Android GridView V4 - An updated version of an earlier drag-drop example. This one shows drag-drop for a GridView, using the latest drag-drop handling in Android V4.
- Android Fragments Example - a simple example for Fragments that is also backward compatible to Android API level 10.
- Three Variations for Image Square Grids - This note describes different ways to have square images on a square grid.
- Android Images With Clickable Areas - This tutorial explains how to have multiple areas within an image that you can touch/click. These hotspots within the image are a bit like image maps in Html.
- Horizontal Scrolling Pages of Images - This one makes use of fragments to break up a gallery of images into separate pages. Pages of images scroll left and right, or you can jump to the start or the end of the images by touching the “First” and “Last” buttons.
- My Dashboard User Interface on Android Tablets
This tutorial shows how to have a dashboard user interface that works on both phones and tablets. It extends the user interface presented in “How To Build A Dashboard User Interface”.
- Drag-Drop for an Android GridView
I built a demo that allows you to add images dynamically to the screen and then drag them onto a GridView. You can then move the images around in the GridView or move them to the trash.
- My Guide to Performance Tuning for Android
This note explains how to use the Java HPROF tools for Android applications and why it is often faster to work with these tools rather than other Android performance tools.
- How To Build A Dashboard User Interface
This note describes a small demo app that illustrates the Dashboard user interface pattern. The main screen has a title bar and six buttons to take you to the different sections of the app.
- Adapting My Dashboard UI To Tablets
The demo builds on “How To Build A Dashboard User Interface”. The app shows one way that you can easily adapt an Android app for tablets. (Note: This article is obsolete. See “My Dashboard User Interface on Android Tablets”.)
- Moving Views in Android – Part 1
I wrote this as I started trying to understand how to use the touch interface to move objects around on the screen. It turns out that what I did was more about getting images to move than getting views to move.
- Moving Views in Android – Part 2: Drag and Drop
I studied the Android Launcher code to see how they supported dragging and dropping views. I then built an example based on that code. Views really move.
- Moving Views in Android – Part 3: Drop Zones
I extended Part 2 a bit to illustrate the Launcher’s DropTarget interface. I called them “Drop Zones”. They represent areas on the screen where dragged views can be dropped. The example also shows how to add movable views dynamically.
- My Introduction to Android Activities
It covers: (a) how activities and views connect; (2) what the activity lifecycle is; (3) what states an activity can be in; (4) how one activity can start another.
- Long Computations in the Main Android Thread
Five steps for moving expensive computations out of the user interface thread.
- Using Android AsyncTask for Background Tasks
My previous note explained one way to take an expensive operation and move it to a background task. Since writing that, I have learned about the AsyncTask class. It is much easier way to do the same thing.
- How to Export and Import Android Virtual Device (AVD) Files
This explains how to move AVD files from one machine to another. It also includes links to download files for six virtual devices.
- How to test on various types of Android devices
This note explains how to get started with testing your app on various types of Android phones and devices. The example shows how to detect the presence of a touch screen.
- How to save Jpeg files
What I learned: (1) how to turn a view into a jpeg (jpg) file; (2) how to save that on an Android device; (3) how to set the background of a view from an image.
- Splash Screen Demo
This explains how I did a splash screen for Android.
Android Developer Tips