| Preface | 1 | P | Preface |
N/A |
| Preface | 6 | P | About O'Reilly Cookbooks |
What is special about the O'Reilly Cookbook Series? |
| Preface | 4 | N | Author's Guide: How to Write Cookbook Recipes |
There should be one place to look for information on writing recipes.
In fact there are two.
All the information about what to write and how to word it is
on the page you are now reading.
All information about formatting using our Wiki-subset markup is
[[Wiki Markup Subset for Cookbook Site|here].
This page is a work in progress and will grow;
if you wrote any other O'Reilly Cookbook (or even read one) please feel free to Comment and we'll incorporate the best comments here. |
| Preface | 137 | N | Recommended Android Web Sites |
N/A |
| Preface | 2 | N | RECIPE WISHLIST (temporary recipe a.k.a. Book Outline) |
There are lots of talented developers out there; we just need a way to help them decide what to write about. |
| Preface | 5 | N | Wiki Markup Subset for Cookbook Site |
Every wiki site seems to accept a slightly different subset of the Wiki language originated in 1995 by Ward Cunningham, and later adopted by Wikipedia and others. Here's how this site works in this regard.
|
| Getting Started | 1939 | P | Introduction: Getting Started |
N/A |
| Getting Started | 352 | P | Learning the Java Language |
Android apps are written in the Java(tm) programming language before they are converted into Android's own class file format, DEX. If you don't know how to program in Java you will find it hard to write Android apps. |
| Getting Started | 545 | N | Preparing the development environment. |
Preparing the development environment. |
| Getting Started | 236 | P | Hello World - Command Line |
You want to create a new Android project without using the Eclipse ADT plug-in. |
| Getting Started | 4137 | N | Hello World - Maven Version |
You want to build an Android app using Maven to handle the administrivia. |
| Getting Started | 278 | P | Hello World - Eclipse Version |
You want to use Eclipse to develop your Android application. |
| Getting Started | 1321 | P | Set Up an IDE on Windows to Develop for Android |
Some owners of Android mobile phones, tablets and other devices may want to develop their own Android applications. They may use a Windows PC, a concise guide to setting up an IDE for that platform is useful. |
| Getting Started | 709 | P | Android Lifecycle |
Android apps do not have a "main" method; you need to learn how they get started and how they stop or get stopped. |
| Getting Started | 1841 | P | Installing .apk files on the emulator |
You have an application's .apk file, and want to installing it on the emulator to check out the application, or because an application you are developing requires it. |
| Getting Started | 691 | P | Installing apps onto an Android Emulator |
App stores are a huge element of the attraction of modern smartphones. The Android Market is the official one, but you may want to use app stores other than Google's Android App store. |
| Getting Started | 682 | P | Sharing Java classes from another Eclipse Project |
You want to use a class from another project, but don't want to copy-and-paste |
| Getting Started | 2514 | P | Referencing libraries to implement external functionality |
You need to reference an external library in your Android source project |
| Getting Started | 1829 | P | Use SDK Samples to Help Avoid Head Scratching |
Sometimes it is a struggle to code up some functionality, especially when the documentation is sketchy or does not provide any examples. |
| Getting Started | 1781 | P | Keeping the Android SDK Updated |
The SDK must be kept updated to allow App developers to work with the latest APIs on the evolving Android platform. |
| Getting Started | 1846 | P | Taking a Screenshot from the Emulator/Android Device |
Taking a screen-shot of the application running on an Android Device. |
| Getting Started | 281 | N | Getting Screenshots |
You need a standard way of getting screenshots for use in the Android Cookbook or any other documentation. |
| Getting Started | 1205 | P | Program: A Simple CountDownTimer example |
Require a simple count down timer |
| Getting Started | 2106 | P | Program: Tipster, a tip calculator for the Android OS |
A tip calculator is quite a simple application. When you go with friends to a restaurant and wish to divide the check and tip, you simply add the tip percentage to the total and divide by the number of diners. Tipster is an implementation of this in Android, to show a complete application. |
| Getting Started | 3427 | N | Getting the source code of Android itself |
How did they do that? |
| Getting Started | 4213 | N | Learning About Android Releases |
You keep hearing about Gingerbread, Ice Cream Sandwiches, and Jelly Beans, and need to know what it all means. |
| Designing a successful Application | 2080 | P | Introduction: Designing a Successful Android application |
N/A |
| Designing a successful Application | 75 | P | Exception Handling |
Java has a well-defined exception handling mechanism, but it takes some time to learn to use it effectively without frustrating either users or tech support people. |
| Designing a successful Application | 1218 | P | Android's Application Object as a "Singleton" |
In the all too common case when you need to access "global" data from within your Android app, the best solution is to to use subclass android.app.Application and treat it as a Singleton with static accessors. |
| Designing a successful Application | 1088 | P | Keeping data when the user rotates the device |
When the user rotates the device, Android will normally destroy and re-create the current Activity. You want to keep some data across this destroy-re-create cycle, but all the fields in your activity are lost during it. |
| Designing a successful Application | 2688 | N | Preserving Activity State |
Users expect Apps to be in the same position as when they were interrupted, e.g. from taking a call. Developers need to know how to restore Activity state. |
| Designing a successful Application | 1922 | P | Monitoring the Battery Level of your Android Device |
Your long-running application needs a means of detecting the battery level for notifying the user when the battery level goes below a certain threshold. |
| Designing a successful Application | 2000 | P | Splash Screens in Android: Method 1 |
Most applications require an introductory opening screen. |
| Designing a successful Application | 2008 | P | Splash Screens in Android: Method 2 |
Most applications require an introductory opening screen. |
| Designing a successful Application | 2043 | P | Designing a Conference/*Camp/Hackathon App |
You want to design an app for use at a Conference, BarCamp, or Hackathon. |
| Designing a successful Application | 1503 | P | Using Google Analytics in Android Application |
Often developers want to track their application in terms of features used by users. How can one find which feature is most used by the App's users? |
| Designing a successful Application | 2763 | P | A Simple Torch Light |
You want to use your smart phone as a torch lamp/flashlight when there is no light or a power failure. |
| Designing a successful Application | 2845 | P | Adapting Android Phone Application to Tablet |
I have developed an application for my smart phone. Is there a way to run it gracefully on a tablet without any significant changes to my code? |
| Designing a successful Application | 2842 | P | First Run Preferences |
You have an application which collects app usage data anonymously, so you need to make the user aware of this the first time they run the app. |
| Designing a successful Application | 2973 | P | Formatting the time and date display |
I want to display the date and time in different standard formats. What is the the easiest approach to achieve this? |
| Designing a successful Application | 2987 | P | Controlling Input with KeyListeners |
My application contains a few text boxes in which I want to restrict the users to enter only numbers; also in some cases to only positive numbers or even integers as well as dates. How do I achieve this with minimum efforts? |
| Designing a successful Application | 2968 | P | Android Application Data Backup |
If a user performs a factory reset or converts to a new Android-powered device, the application loses stored data or application settings. |
| Designing a successful Application | 2847 | P | Working Without Tooltips: Use Hints Instead |
Android devices can have small screens, there may not be room for help text, and tooltips are not part of the platform. |
| Designing a successful Application | 4063 | N | Onboarding - The Welcome Process |
Most applications will require some introduction for non-technical users. The "onboarding" process, that of introducing the user and your app to each other, is your chance to inform, to inspire, and to get the user excited about using your app. This is a standard aspect of "user experience" (UX) design, but is often overlooked when technical people design an app. |
| Designing a successful Application | 3856 | N | Use Reflection to Safely Access Version-dependent API |
You need to access an Android API that was added recently, but still have your app work (possibly with less functionality) on devices running older releases. |
| Testing | 1944 | P | Introduction: Testing |
N/A |
| Testing | 456 | P | How to TDD(test driven development) Android App |
Lack of mocking support making TDD Android App cumbersome. |
| Testing | 1456 | P | Set Up an Android Virtual Device (AVD) for App Testing |
Successful Apps must run on a wide range of Android devices and versions. |
| Testing | 3369 | P | Test on a huge range of devices with cloud-based testing |
You need to test your app on a wide variety of devices. |
| Testing | 3352 | P | Creating and Using a Test Project |
You need to create and use a new Test Project to test your Android application. |
| Testing | 785 | P | How to troubleshoot "The application has stopped unexpectedly. Please try again" |
Your app crashes and you are uncertain as to why. |
| Testing | 1906 | P | Debugging using Log.d and LogCat |
Many a times even though the Java code compiles without error, running the application crashes giving a 'Force Close' (or similar) error message. |
| Testing | 3200 | P | Getting Bug Reports from Users Automatically with BugSense |
Users don't necessarily inform you every time your app crashes,and when they do, often important details are omitted. You'd like a service that catches every exception and reports it in detail. |
| Testing | 3575 | P | Using a local runtime application log for analysis of field errors or situations |
Users reported something about your App that you don't think should happen, but now that the 'release mode' App is on the market, you have no way to find out whats going on in the users environment and bug reports end up in a 'cannot reproduce' scenario. |
| Testing | 2636 | P | Activity LifeCycle Scenarios for Testing |
Apps should be resilient to the Activity Lifecycle. Developers need to know how to reproduce different lifecycle scenarios. |
| Testing | 1286 | P | Keep Your App Snappy With StrictMode |
Making sure your app's GUI is as snappy as possible isn't easy. But with the help of Android's StrictMode it doesn't seem all that bad. |
| Testing | 1253 | P | Barrel of Monkeys |
Not quite the Turing test, but if your app can pass the monkey test, you deserve a pat on the back. |
| Testing | 2347 | P | Sending text messages and placing calls between AVDs |
You have made an app which needs to place or listen for calls or send or receive text messages and you want to test this. |
| Testing | 4233 | P | Checking Android Source Code with Android Lint |
Your code looks OK, but you want to see if it passes muster when subjected to expert scrutiny. |
| Content Providers | 3109 | P | Introduction: Content Providers |
N/A |
| Content Providers | 3112 | P | Retrieving Data from a Content Provider |
You want to read from a Content Provider such as Contracts. |
| Content Providers | 1558 | P | Writing a Content Provider |
Often the application generates data, which can be processed and analyzed by another application. What is the safest way to achieve this, without giving direct access to our application's database? |
| Content Providers | 1779 | P | Android Remote Service |
How to write remote service in the android? How to access it from other application? |
| Graphical User Interface | 1054 | P | Introduction: GUI |
N/A |
| Graphical User Interface | 10 | P | User Interface Guidelines |
Lots of developers, even good ones, are very bad at user interface design. |
| Graphical User Interface | 1272 | P | Handling Configuration Changes by Decoupling View from Model |
When your device's configuration changes (most frequently due to an orientation change), your Activity is destroyed and recreated, making state information difficult to maintain. |
| Graphical User Interface | 2719 | N | Portrait or Landscape? Both! |
An Activity's screen should be useable in both portrait and landscape modes. |
| Graphical User Interface | 1397 | P | Basics: A Button with its Click Action Handler |
You need to do something when the user presses a Button. |
| Graphical User Interface | 2359 | P | Five Ways to Wire Up an Event Listener |
Developers need to be familiar with the different ways to code event handlers, they they will come across different methods in tutorials, samples and online snippets. |
| Graphical User Interface | 697 | P | Using CheckBoxes and RadioButtons |
You want to offer the user a set of choices that is more limited than a list. |
| Graphical User Interface | 1709 | P | Effective UI design using Image Buttons |
While building an application, many times the UI design requires the effective use of image buttons. It can save effort compared to text views with descriptive text, since an image can explain the scenario much better than a lot of words. |
| Graphical User Interface | 3307 | N | Creating your own Custom Button Style |
You need to create your own custom button style for all your application buttons. |
| Graphical User Interface | 3100 | P | Drop-down Chooser via the Spinner Class |
You want to offer a drop-down choice item. |
| Graphical User Interface | 3255 | P | Handle LongPress/LongClick Events |
You want to listen for long press / long click events and react to them, without having manually to check for multiple events. |
| Graphical User Interface | 3683 | P | Basics: Text Fields with TextView and EditText |
You want to display text on the screen, either read-only or editable. |
| Graphical User Interface | 2122 | P | Constrain EditText Values with Attributes and the TextWatcher Interface |
There is a need to limit the range and type of values being input. |
| Graphical User Interface | 2135 | P | Implementing Autocompletion in Android. |
Save the user from typing entire words, instead auto-complete the entries. |
| Graphical User Interface | 827 | N | Autocompletion with Icons/Images |
Searching for items/entries, that can occur in more that a single category. Perform autocompletion and simultaneously make the difference in categories immediately apparent using icons. For example, the term Pain (in bold) occurs in both Symptoms category as well as Reactions category, but also text in the Notes category.
Categories:
Symptoms: Pain, Depression, Weakness
Reactions: Pain, Inflammation, Itchiness
Notes: I had a pain in my buttocks. |
| Graphical User Interface | 404 | P | Feed AutoCompleteTextView using a SQLite database query |
Although the Android documentation contains a complete working example of using AutoCompleteTextView with an ArrayAdapter, just substituting a SimpleCursorAdapter into the example does not work. |
| Graphical User Interface | 2901 | P | Turning Edit Fields into Password Fields |
You need to designate an EditText as a password field, so that characters the user types will not be visible to "shoulder surfers". |
| Graphical User Interface | 422 | P | Change The Enter Key to "Next" on the Soft Keyboard |
Several apps, including the Web Browser and the Contacts app, replace the "Enter" key on the on-screen keyboard with a "Next" key that gives focus to the next data entry view. How do you add this kind of polish to your own apps? |
| Graphical User Interface | 2283 | P | Processing key press events in an Activity. |
Intercepting the keys pressed by the user and performing actions corresponding to them. |
| Graphical User Interface | 1438 | P | Let Them See Stars: Using RatingBar |
You want the user to choose from a number of identical GUI elements in a group to indicate a value such as a "rating" or "evaluation" |
| Graphical User Interface | 671 | P | Make a View Shake |
You want a View component to shake for a few seconds to catch the user's attention. |
| Graphical User Interface | 1242 | P | Haptic Feedback |
Building user confidence that their actions had an effect is a requirement for any app on any platform. The canonical example is displaying a progress bar to let users know their action took effect and it's being processed. For touch interfaces this technique still applies, but the advantage of a touch interface is that developers have the opportunity to provide physical feedback, users are capable of actually feeling the device react to their actions. |
| Graphical User Interface | 1693 | P | Navigate different activities within a TabView |
You want to move from an activity within a tab view to another activity within the same tab. |
| Graphical User Interface | 1584 | P | Creating your own Custom Title Bar |
You cannot have any buttons or any custom text in the standard title bar. |
| Graphical User Interface | 272 | P | Formatting Numbers |
You need to format numbers, because the default formatting of Double.toString() and friends do not give you enough control over how the results are displayed. |
| Graphical User Interface | 389 | P | Formatting with Correct Plurals |
You're displaying something like "Found "+ n + " items", but in English, "Found 1 reviews" is ungrammatical. You want "Found 1 review" for the case n == 1.
|
| Graphical User Interface | 1670 | P | Start a Second Screen from the First |
New App developers need a simple example on how to open another screen, thus understanding how Android handles UI creation. |
| Graphical User Interface | 1599 | P | Loading Screen in between two Activities |
If you are getting an black screen before loading an activity here's how to avoid it. |
| Graphical User Interface | 2144 | P | Using SlidingDrawer to Overlap Other Components |
The proper layout of SlidingDrawer isn't covered to well in the SDK documentation. Here's how to use the control to overlay other components in a layout. As well as how to position elements in the underlying layout to avoid the drawer handle. |
| Graphical User Interface | 996 | P | Customize the SlidingDrawer component to animate/transition from the top down. |
You want to customize the SlidingDrawer component to animate/transition from the top down. |
| Graphical User Interface | 983 | N | SlidingDrawer Overlapping other UI components |
You want the SlidingDrawer to overlap other UI components eg. ListView |
| Graphical User Interface | 2318 | P | Add a Border with Rounded Corners to a Layout |
There is a need to put a border around an area of the screen or add interest to a user interface. |
| Graphical User Interface | 2871 | P | Gesture Detection in Android |
You want to traverse through different screens using simple gestures like flip/scroll the page. |
| Graphical User Interface | 923 | N | Simple Calendar |
You desire a simple and native Month view Calendar, which can easily be skinned. |
| Graphical User Interface | 1160 | P | Building a UI using Fragments API of Android 3.0 in Android 2.2 |
You want to add Fragments to the UI in Android 2.0+ versions, though they were originally only available in 3.0+.
Fragments, as the name suggests, are nothing but the small chunks of UI which constitutes a single activity. It can be treated as individual portlets of a portal page. It is very similar to activity in terms of its looks, lifecycle, etc but it is also different than Activity in the sense that 'A fragment should always reside in an Activity'; fragments cannot exist independently as Activities. |
| Graphical User Interface | 1090 | P | Android 3.0 Photo Gallery |
Display a photo gallery |
| Graphical User Interface | 605 | P | Creating a Simple App Widget |
Widgets are simple graphical user interfaces that allow users to easily interact with an existing application (activity and/or service). It's rather simple to create one. Just try it! |
| Graphical User Interface | 3972 | N | Using a Compound Drawable |
How do I use a "compound drawable", a TextView that contains an ImageView in addition to its text? |
| Graphical User Interface | 4012 | N | Change the Text Size for a Spinner |
A Spinner is not like a TextView, the textSize attribute will not work (a Spinner is a ViewGroup). |
| Graphical User Interface | 4383 | N | Adding a Share Action to your ActionBar |
You want to add the standard Share icon to your ActionBar and have it handle an application-provided Intent. |
| Graphical User Interface | 4222 | N | Choosing a Layout Manager (ViewGroup) |
You want to know how to arrange your GUI components within your view. |
| Graphical User Interface | 4188 | N | Prevent flickering when user performs scrolling on a view |
How annoying is it when you have created a view only to find screen flicking causes the display to flick vertically before being readjusted |
| Graphical User Interface | 4135 | N | Custom Layouts |
This is a placeholder recipe for some ideas on layout management aka ViewGroup |
| Graphical User Interface | 3823 | N | Using Existing/Standard Drawables |
You want to use existing drawables where possible to give your app a look that is consistent with standard Android. |
| Graphics | 1946 | P | Introduction: Graphics |
N/A |
| Graphics | 1141 | P | Using a Custom Font |
The range of fonts that comes with Android 2.x is amazingly miniscule - three variants of the "Droid" font. You want something better. |
| Graphics | 1529 | P | Draw a spinning cube with OpenGL ES |
You want to create a basic OpenGL ES application. |
| Graphics | 1425 | P | Adding control to the OpenGL spinning cube |
You want to interact with an OpenGL polygon using the keyboard of your device. |
| Graphics | 3512 | P | Freehand Drawing Smooth Curves, Signatures, etc. |
You want to allow the user to draw smooth curves, such as freehand bezier curves, legal signatures, etc. |
| Graphics | 380 | P | Taking a Picture Using an Intent |
You want to take a picture from within your app and don't want to write a lot of code. |
| Graphics | 1392 | P | Taking a Picture Using android.media.Camera |
You want to have more control on the various stages involved when taking a picture. |
| Graphics | 3324 | P | Scan a Barcode or QR code with Google ZXing Barcode Scanner |
You want your App to be able to scan a Barcode or QR Code. |
| Graphics | 2289 | P | Using AndroidPlot to display charts and graphs in your Android application. |
Depicting data graphically in an Android application. |
| Graphics | 2549 | P | Use Inkscape to Create an Android Launcher Icon |
Every good Android App deserves a custom launcher icon. |
| Graphics | 2159 | P | Easy Launcher Icons from OpenClipArt.org using Paint.NET |
A good icon for an App is important. It helps set an App apart from others and is a must for an App to appear professional. |
| Graphics | 3280 | P | Using Nine Patch Files |
When designing a User Interface you want to change the default View backgrounds to fit in with an App's overall style. The backgrounds must be able to scale correctly for different size Views. |
| Graphics | 851 | P | Android HTML5 RGraph Charting |
Need to visualize data in a chart and ability to interaction with the plot/chart via Javascript. |
| Graphics | 2749 | P | Simple Raster Animation |
There is a need to add an animated image to a screen. |
| Graphics | 3230 | N | ImageButton State Graphics Using Inkscape |
You need to add interest to a screen with custom buttons. |
| Graphics | 2273 | P | Pinch to zoom |
Use the finger touch to change the position of an image viewed on the screen and use pinch-in and pinch-out movements for zooming in and zooming out operations. |
| Multimedia | 3151 | P | Introduction: Multimedia |
N/A |
| Multimedia | 1383 | P | Play a Youtube Video |
You want to play a video from Youtube on your device |
| Multimedia | 1495 | P | Using Gallery with ImageSwitcher |
Creating UI for browse through multiple images. |
| Multimedia | 1375 | P | Grabbing a video using MediaRecorder |
You want to grab a video using the built-in device camera and save it to disk. |
| Multimedia | 1405 | P | Android Face Detection |
Face detection is a cool and fun hidden api feature of Android, and has been around since Android 1.5. In essence face detection is part of a machine learning technique of recognizing objects using a set of features. |
| Multimedia | 1399 | P | Playing audio from a file |
You want to play an audio file stored on the device. |
| Multimedia | 1628 | P | Playing Audio without Interaction |
You want to play an audio file with no interaction. |
| Multimedia | 1246 | P | Using Speech to Text |
How to get speech input and display it as text |
| Multimedia | 1632 | P | Making the Device Speak with TTS |
You want your application to pronounce words of text so the user can perceive them without watching the screens (e.g., when driving). |
| Multimedia | 4069 | N | Playing a Video in your App |
You want to play a Video in your application, as opposed to launching a media player application using an Intent (as shown in 1651). |
| Data Persistence | 100 | P | Introduction: Data Persistence |
N/A |
| Data Persistence | 3220 | P | Getting File Information |
You need to know all you can about a given file "on disk", typically on internal memory or on the SD Card. |
| Data Persistence | 2452 | P | Accessing data from a file shipped with the App rather than in the filesystem |
You need to access data stored in a file in /res/raw directory. |
| Data Persistence | 366 | P | Listing a Directory |
You need to list the filesystem entries named in a directory. |
| Data Persistence | 1342 | P | Getting total and free space on the SD card |
You want to find out the amount of total and available space on the SD card |
| Data Persistence | 3411 | P | Easy User Preferences |
You want to let the user specify one or more preferences values, and have them persisted across runs of the program. |
| Data Persistence | 561 | P | Default shared preferences consistency check |
Android provides a very easy way to setup default preferences by defining a PreferenceActivity and providing it a resource file. What is not clear is how to perform checks on preferences given by the user |
| Data Persistence | 654 | P | Advanced text search |
How to build a data layer to store and search text data using wildcards or expressions like and, or, not, etc. |
| Data Persistence | 1919 | P | Creating a SQLite database in an Android application. |
Data persistence in the application. |
| Data Persistence | 1953 | P | Inserting values into a SQLite database. |
Adding values into a SQLite database. |
| Data Persistence | 1949 | P | Retrieving data from a SQLite database. |
Loading items from an existing SQLite database. |
| Data Persistence | 413 | P | Work With Dates in SQLite |
Android's embedded SQLite3 database supports date and time data directly, including some useful date and time arithmetic. However, getting these dates out of the database is troublesome: there is no Cursor.getDate() in the Android API. |
| Data Persistence | 2211 | P | Parsing JSON using JSONObject |
Many websites provide data in JSON. Many applications require to parse JSON and provide that data in the application. |
| Data Persistence | 1656 | N | Parsing JSON using the Jackson Parser |
Parse JSON using Jackson parser |
| Data Persistence | 80 | P | Parsing an XML document using the DOM API |
You have data in XML, and you want to transform it into something useful in your application. |
| Data Persistence | 2217 | P | Parsing an XML document using an XmlPullParser |
You have data in XML, and you want to transform it into something useful in your application. |
| Data Persistence | 3095 | N | Save Data in the cloud with CouchDB and Ektorp |
You want to persist data locally and have it backed to a persistence store in the cloud. |
| Data Persistence | 334 | P | Adding a Contact |
You have some contact information that you want to save for use in the Contacts application. |
| Data Persistence | 3115 | P | Reading Contact Data |
You need to extract details, such as a phone number or email address, from the Contacts database. |
| Data Persistence | 3852 | N | Adding Calendar Events |
You want to add an event to the user's on-device calendar. |
| Telephone Applications | 3137 | P | Introduction: Telephone Applications |
N/A |
| Telephone Applications | 1109 | P | Do something when the phone rings |
You want to act on an incoming phone call and do something with the incoming number. |
| Telephone Applications | 1151 | P | Process outgoing calls |
You want to block certain calls, or alter the phone number about to be called. |
| Telephone Applications | 1198 | P | Dialing the phone |
You want to dial the phone from within an application, without worrying about details of telephony. |
| Telephone Applications | 2686 | P | Sending single or multipart SMS messages |
A simple way to send either a single part or a multipart (handing the message concatenation UDH) from a single entry point |
| Telephone Applications | 2017 | P | Receiving an SMS in an Android Application. |
Enabling your application to receive an SMS. |
| Telephone Applications | 2019 | P | Using Emulator Controls to send SMS to the Emulator. |
For testing SMS based applications sending SMS to the emulator. |
| Telephone Applications | 3071 | P | Android TelephonyManager. |
I want to obtain network related and telephonic information on my phone. How to do this? |
| Telephone Applications | 2133 | N | Getting Phone Details. |
Some Android applications require the Android device's IMEI number, the phone number or the phone type (GSM/CDMA). |
| Networked Applications | 76 | P | Introduction: Networking |
N/A |
| Networked Applications | 79 | P | Using a RESTful Web Service |
You need to access a RESTful Web Service. |
| Networked Applications | 306 | P | Extracting Information from Unstructured Text using Regular Expressions |
You want to get information from another source, but they don't make it available as information, only as a viewable web page. |
| Networked Applications | 839 | P | Parsing RSS/ATOM feeds parsing with ROME |
You want to parse RSS/Atom feeds. |
| Networked Applications | 2499 | N | Sending an Email using Intents |
You need to send an Email through your application |
| Networked Applications | 2679 | N | Simple HTTP client functions |
How to access services over HTTP fcrom a handset application |
| Networked Applications | 2595 | P | Using MD5 to Digest Free Text |
Sometime it is necessary to save or send free text in an encrypted from. Android provides a standard Java MD5 class to allow plaintext to be replaced with an MD5 digest of the original text. This is a one-way digest that is not believed to be easily reversible (if you need that, use Java Cryptography). |
| Networked Applications | 2493 | P | Converting text into hyperlinks |
You need to make webpage URLs into hyper-links in a TextView of your Android app |
| Networked Applications | 2149 | P | Accessing a web page through your Android application |
Opening a website within your application. |
| Networked Applications | 2373 | P | Customizing a WebView |
You need to customize the WebView opened by your application. |
| Social Networking | 102 | P | Introduction: Social Networking |
N/A |
| Social Networking | 1313 | N | Facebook Integration |
Integrate an Android application with Facebook |
| Social Networking | 2213 | P | Loading a user's Twitter timeline (using JSON) |
You want to load the Twitter timeline of a user in an Android application. |
| Social Networking | 1578 | P | Social Networking Integration using Http |
Instead of diving into the API you can simply add Social networking support. |
| Location and Map Applications | 3185 | P | Introduction: Location-Aware Applications |
N/A |
| Location and Map Applications | 323 | P | Getting Location Information |
You want to know where you are. |
| Location and Map Applications | 1703 | P | Access GPS information anywhere in your application |
You need access the GPS location in any class of your application. |
| Location and Map Applications | 1229 | P | Mocking GPS Coordinates On A Device |
You need to demonstrate your application, but are scared it might choke trying to triangulate your GPS coordinates. Or you'd like to simulate being in a place you're not. |
| Location and Map Applications | 1454 | P | Geocoding and Reverse Geocoding |
How to Geocode and Reverse Geocode on Android |
| Location and Map Applications | 4285 | P | Getting Ready for Google Maps API v2 Development |
You want to get set up to use the current (V2) Google Maps API.
|
| Location and Map Applications | 1291 | P | Getting ready for Google Maps API V1 development |
You want to get ready to include Google MapView layout elements in your Android app |
| Location and Map Applications | 1283 | N | Using Google Maps in your Android App |
Sometimes the steps needed to add a Google Map and show the User's location to Android Apps is not clear as water on the Internet and Documentation. |
| Location and Map Applications | 1717 | N | Location search on Google maps |
Doing a location search using Google Maps. |
| Location and Map Applications | 1019 | N | How to show your current location in a map |
You want to see where you are in a map using the built-in GPS in Android devices |
| Location and Map Applications | 1771 | P | To Add Device's current location to Google Maps |
Adding Current location of the device on Google maps. |
| Location and Map Applications | 1541 | P | Draw a location marker on a Google MapView |
You have a geo location and you want to display it on a Google MapView view object |
| Location and Map Applications | 2338 | N | Draw your current location on a Google MapView |
You want to draw your current location on a Google MapView and want to update the location marker on the MapView when the location changes. |
| Location and Map Applications | 2308 | P | Drawing multiple location markers on a MapView |
You have several GeoPoints which you want to display on a Google MapView. |
| Location and Map Applications | 1752 | P | Creating Overlays for a Google MapView |
Demarcating a point on a Google map using an image. |
| Location and Map Applications | 2287 | P | Changing Views of a MapView. |
Showing an appropriate view of a MapView based on the context in the application. |
| Location and Map Applications | 1354 | P | Draw overlay icon without using Drawable |
How can you display an map overlay in MapView without using Drawable objects? |
| Location and Map Applications | 897 | P | MapView inside TabView |
You want to place a MapView object within TabView.
Target application outline
- Draw two empty tabs
- Show map on the first tab
|
| Location and Map Applications | 462 | P | Handling longpress in a map |
For some map applications you might want to let the user trigger an action related to an arbitrary point on the map, for example through a context menu. Enabling the user to do a longpress on the map is among the more intuitive ways to expose this kind of functionality, but support for this is not built in to Android. Let me show you how you can add it yourself. |
| Location and Map Applications | 2521 | P | Using OpenStreetMap |
You want to use OpenStreetMap (OSM) map data in your application in place of the standard Google Maps. |
| Location and Map Applications | 2618 | P | Creating overlays in OpenStreetMaps |
You need to create overlays for your OpenStreetMap |
| Location and Map Applications | 2654 | P | Using a scale on an OpenStreetMap |
You need to show a map scale on your OSM to indicate the level of zoom on the MapView |
| Location and Map Applications | 2625 | P | Handling touch events on an OpenStreetMap Overlay |
You need to perform actions when the overlay on an OpenStreetMap is tapped |
| Location and Map Applications | 2658 | P | Getting location updates with OpenStreetMaps |
You need to react to the changes in the device's location and move the map focus to changed location |
| Location and Map Applications | 4297 | P | Using the Google Maps API V2 |
Now that you've set up your environment as in 4285, you want to do something with the Maps API. |
| Accelerometer and other Sensors | 2056 | P | Introduction: Sensors |
N/A |
| Accelerometer and other Sensors | 2047 | P | Checking for the Presence or Absence of a Sensor |
Before using an Android device for a sensor-based application, the programmer needs to ensure that the required sensor is supported by the device. |
| Accelerometer and other Sensors | 529 | P | Using the accelerometer to detect shaking of the device |
Sometimes it makes sense to evaluate not only on-screen input, but also gestures like tilting or shaking the telephone. But how can you use the accelerometer to detect whether the phone has been shaken? |
| Accelerometer and other Sensors | 2051 | P | Checking for device facing up or facing down based on screen orientation using Accelerometer. |
Check for the orientation (Facing up/Facing Down) of the Android device. |
| Accelerometer and other Sensors | 2085 | P | Finding the orientation of an Android device using Orientation sensor. |
Being able to detect which side of the android device is higher up compared to the rest (Top/Bottom/Right/Left side) |
| Accelerometer and other Sensors | 2385 | P | Reading the Temperature Sensor |
You need to get temperature values using the temperature sensor. |
| Bluetooth | 3159 | P | Introduction: Bluetooth |
N/A |
| Bluetooth | 1978 | P | Enabling Bluetooth and making the device Discoverable. |
If the application requires the Bluetooth adapter to be switched On, the programmer needs to check if its enabled. If it is not, the use should be prompted to enable Bluetooth. For allowing remote devices to detect the host device, the host device should be made discoverable. |
| Bluetooth | 1665 | P | Connecting to Bluetooth enabled device |
You need to connect to other bluetooth enabled device and want to communicate with it. |
| Bluetooth | 1991 | P | Listening for Bluetooth Connection Requests. |
Creating a listening server for Bluetooth Connections. |
| Bluetooth | 1615 | P | Bluetooth Device discovery |
You want to display a list of Bluetooth devices in the vicinity. |
| Other Programming Languages | 1036 | P | Introduction: Other Programming Languages |
N/A |
| Other Programming Languages | 1365 | P | Run external/native Linux command |
Sometimes it can be convenient to start one of the Linux commands that are available on the phone such as rm, sync, top, uptime... |
| Other Programming Languages | 77 | P | Running Native Code with JNI on the NDK |
You need to run parts of your application natively in order to use existing C/C++ code or, possibly, to improve performance of CPU-intensive code |
| Other Programming Languages | 1034 | P | Getting Started with ''Scripting Layer for Android'' (formerly Android Scripting Environment) |
You want to write your application in one of several popular scripting languages, or, you want to program interactively on your phone. |
| Other Programming Languages | 2426 | N | Installing and Using Android Scripting Environment (ASE) |
You need to run scripts (python, perl, lua etc) on an Android device. |
| Other Programming Languages | 2885 | P | Creating alerts in SL4A |
You need to create an alert box or pop-up dialog using Python in the Scripting Layer for Android (SL4A) |
| Other Programming Languages | 2907 | N | Creating notifications in ASE |
You need to create a notification using python in Android Scripting Environment |
| Other Programming Languages | 2834 | P | Get your Google Documents and show them in a list view using SL4A |
You need to get the details of your Google documents after logging in with your Google ID and password. |
| Other Programming Languages | 2505 | N | Making a Toast in Python (Using Android Scripting Environment) |
You need to make a Toast using python (Using ASE) |
| Other Programming Languages | 2916 | P | Sharing your scripts (ASE) using QR codes |
You need to distribute your ASE scripts using QR (Quick Response) Codes |
| Other Programming Languages | 1046 | N | Running Adobe Air/Flex on Android |
Developing AIR/Flex Apps for Android. |
| Other Programming Languages | 2074 | N | Intro to Flex 4.5 Android Programming |
Creating an Android-application using Flex 4.5. The application uses a company stock symbol as query, and an HTTP service to Google's Finance API, retrieving stock data. |
| Other Programming Languages | 2369 | P | Using native handset functionality from webview using Javascript |
The advent of HTML5 as standard in many browsers means that applications can exploit the features of the HTML5 standard to create applications much more quickly than if they were written in native Java. This sounds great for many applications but alas not all of the cool functionality on the device is accessible through HTML5 and Javascript. Webkits attempt to bridge the gap but may not provide all the functionality needed in all cases. |
| Other Programming Languages | 3542 | P | Platform Independent Application Using PhoneGap/Cordova |
You want an application to run on different platforms like iOS, Android, BlackBerry, Bada, Symbian, Windows etc. |
| Other Programming Languages | 3549 | N | PhoneGap (Android) Using JQuery Mobile |
You need to use JQuery mobile in your Mobile App (since it is platform independent). |
| Other Programming Languages | 3547 | N | PhoneGap (Android) Accessing your java files from javascript |
You need to access your methods from Activity.java in JavaScript |
| Other Programming Languages | 3224 | N | Easy Apps with App Inventor (placeholder recipe) |
You want to generate Android applications without needing to write either Java code or HTML. |
| Strings and Internationalization | 350 | P | Introduction: Internationalization |
N/A |
| Strings and Internationalization | 358 | P | Internationalizing Application Text |
You want the text of your buttons, labels and so on to appear in the user's chosen language. |
| Strings and Internationalization | 2874 | P | Finding and Translating Strings |
You need to find all the strings in your application, internationalize them, and begin the process of translating them. |
| Strings and Internationalization | 2219 | P | The Nuances of strings.xml |
Entering text in strings.xml on most occasions is easy enough, but sometimes peculiar results crop up. |
| Packaging, deploying and selling | 502 | P | Introduction: Packaging, Deploying and Distributing |
N/A |
| Packaging, deploying and selling | 660 | P | Creating a Signing Certificate |
You want to publish an application, and you need a "signing key" to complete the process. |
| Packaging, deploying and selling | 662 | P | Signing Your Application |
You want to sign your application prior to uploading it to the Android Market. |
| Packaging, deploying and selling | 600 | P | Distributing Your Application via the Android Market |
You want to give away or sell your application via the Android Market. |
| Packaging, deploying and selling | 724 | P | How to integrate Admob into your app |
You want to monetize your free app by showing ads within it.
|
| Packaging, deploying and selling | 2111 | P | Obfuscating and Optimizing with ProGuard |
You want to obfuscate your code, or optimize it (for speed or size), or all of the above. |
| Packaging, deploying and selling | 3172 | P | Provide a Link to other Published Apps in the Market |
Your developed App is running on a device; you want a link to your other Apps on the Android Market to encourage users to try them. |
| Packaging, deploying and selling | 3156 | N | Building your App as an Open Source Project |
You want to build your Android App as an open source project, building it collaboratively with a vibrant community of developers. |
| Packaging, deploying and selling | 3562 | N | Merging two different applications in one application. |
If you have two different application say one is application and one is service layer then how to send them in one apk? |
| Packaging, deploying and selling | 3961 | N | Running Android Apps on the BlackBerry Playbook |
Your App works fine on real Android devices, and you're ready to move it to the next easy target: the Reserch In Motion (RIM) BlackBerry Android Player. |
| Packaging, deploying and selling | 4124 | N | Alternate Home Screen (Kiosk Mode Phone) |
You need to provide an alternate home screen for your phone. |
| Packaging, deploying and selling | 3794 | N | Passing Android Code Around |
There are plenty of code samples around, this site included, a clean way to use (and generate) example code is needed. |
| GUI: ListView | 1882 | P | Introduction: ListView |
N/A |
| GUI: ListView | 397 | P | Building list-based applications with ListView |
Many mobile applications follow a similar pattern, allowing users to browse and interact with multiple items in a list. How can developers use standard Android UI classes to quickly build an app that works the way users will expect, providing them a list-based view onto their data. |
| GUI: ListView | 3384 | N | Add a Selection List using ListActivity |
Your App needs the user to select an item from several options. |
| GUI: ListView | 1865 | P | 'No data' View for Lists |
When the ListView has no items to show, the screen would just appear blank. In order to show an appropriate message on the screen, indicating the absence of data in the list. |
| GUI: ListView | 1418 | P | Advanced ListView: populating a list with images and text |
You want to write a ListView that shows an image next to a string. |
| GUI: ListView | 830 | N | ListView with Icons/images |
You want to display data in a ListView with an icon image and some text for each ListView row. |
| GUI: ListView | 992 | P | Sectioned Headers in ListViews |
You want to display categorized items e.g., by time/day, by product category or sales price. |
| GUI: ListView | 1761 | N | Making Lists Behave Nicely |
Lists are easy to get started with, but there are a lot of variations that will provide optimal user experience. |
| GUI: ListView | 588 | P | Writing A Custom List Adapter |
Lists are ubiquitous throughout mobile applications. Android provides a simple and powerful interface to make exactly the list you need. This recipe explains the steps for customizing the content of a ListView. |
| GUI: ListView | 3759 | P | Keeping the ListView with the User's Focus |
You don't want to distract the user by moving the ListView to its beginning, away from what the user just did. |
| GUI: ListView | 862 | P | Orientation Changes : From ListView data values to Landscape Charting |
Accomplish view changes on device orientation changes. For example, data values to be plotted are contained in a Portrait ListView, and upon device orientation a graphical display of the data values in a chart/plot is displayed. |
| Gaming and Animation | 1816 | P | Introduction: Gaming and Animation |
N/A |
| Gaming and Animation | 2030 | P | Game Programming with Flixel-Android |
Game design |
| Gaming and Animation | 2034 | P | Game Programming using AndEngine (Android-Engine) |
Game design and programming using the AndEngine game framework |
| Gaming and Animation | 3345 | P | Processing timed keyboard input |
To determine if a user generated message, like a key press/release, has occoured within a certain time interval.
Useful in game input handling. |
| System and Device Control | 104 | P | Introduction: System and Device Control |
N/A |
| System and Device Control | 1351 | P | Phone network/connectivity information |
You want to find information about phones network connectivity |
| System and Device Control | 2326 | P | Reading information from Manifest file |
You want to read project settings (e.b, app version) data from the AndroidManifest file during program execution. |
| System and Device Control | 2584 | P | Changing incoming call notification to Silent, Vibrate, or normal |
You need to put the Android device to silent, vibrate or normal mode |
| System and Device Control | 2544 | P | Copying text and getting text from the Clipboard |
You need to copy text to the clipboard and access the text stored on the clipboard |
| System and Device Control | 2301 | P | Making LED based notifications |
Some Android phones are equipped with LEDs. An application can flash different color lights using the LED. |
| System and Device Control | 2092 | P | Making the Device Vibrate. |
Through your application, you wish to notify the user of an event by means of device's vibration. |
| System and Device Control | 2457 | P | Running shell commands from your application |
You need to run a shell command from your application (for instance pwd, ls etc). |
| System and Device Control | 2467 | P | Determining Whether a Given Application is Running |
How do i know if mine or some other app is running? |
| System and Device Control | 2077 | N | Rebooting the Device |
For some strange reason, you want the user's Android device to reboot. |
| System and Device Control | 2404 | N | Rebooting the Device - The Hack Way |
If you want to reboot an emulator, the hack way! |
| Inter/Intra-Application Communication | 73 | P | Introduction: Inter-Communication |
N/A |
| Inter/Intra-Application Communication | 1651 | P | Opening a Web Page, Phone Number or anything else with an Intent |
The Intent mechanism is fundamental to Android; it allows one application to have some entity processed by another application without knowing or caring what that application is. |
| Inter/Intra-Application Communication | 870 | P | Email Text From a View |
You want to send an Email containing text or images from a View. The data to be emailed is passed as a parameter using an Intent. |
| Inter/Intra-Application Communication | 1441 | P | Sending an email with attachments |
You want to send an e-mail with attachments. |
| Inter/Intra-Application Communication | 809 | P | How to push string-values using Intent.putExtra() |
You need to pass some parameters into an activity while launching it. |
| Inter/Intra-Application Communication | 899 | P | Retrieving data from a Sub-Activity back to your Main Activity |
Your main activity needs to retrieve data from a sub activity.
|
| Inter/Intra-Application Communication | 844 | P | Keeping a Service running while other apps are on display |
You want part of your application to continue running in the background while the user switches to interact with other apps. |
| Inter/Intra-Application Communication | 934 | P | Sending/Receive broadcast message |
You want to make an activity which receives a simple broadcast messages sent by another activity |
| Inter/Intra-Application Communication | 1713 | N | Intercommunication amongst Applications |
You need to get different applications deployed on a device to communicate. For instance, the running application wishes to notify another application (which is in the background) of a certain event. |
| Inter/Intra-Application Communication | 1662 | P | Starting a service after phone reboot |
You have a service in your app and you want it to start after the phone reboots. |
| Inter/Intra-Application Communication | 1370 | P | Creating a Responsive Application using Threads |
How to create a responsive application. |
| Inter/Intra-Application Communication | 1961 | N | Eating Too Much CPU Time In The UI Causes A Nasty Result |
Any time consuming or intensive code in an event listener will make the UI appear slow and potentially cause an Application Not Responding error.
|
| Inter/Intra-Application Communication | 1433 | N | AsyncTask: Do background tasks and modify the GUI |
If you run a thread to execute some source code, you can't use or change any graphical widget from this thread and you don't know when the thread has finished. |
| Inter/Intra-Application Communication | 2260 | P | Using AsyncTask to do background processing |
You have to do some heavy processing, or load resources from the network and want to show the progress and results in the UI. |
| Inter/Intra-Application Communication | 921 | P | Sending messages between threads using activity thread queue and Handler class |
You need to pass information or data from a Service or other background task, to an Activity. Since Activities run on the UI thread it is not safe to call them from a background thread. |
| Inter/Intra-Application Communication | 877 | P | Java to JavaScript: Android Epoch HTML/Javascript Calendar |
You require a custom calendar using Javascript. This recipe also shows how to interact between Javascript and Java. |
| Inter/Intra-Application Communication | 4426 | N | Exchanging Array Data between Java and JavaScript |
You want to push array data from Java to JavaScript and/or from JavaScript to Java |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 3734 | P | Introduction: GUI Alerts |
N/A |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 1891 | P | Create and Display a Menu |
Within the Activity, showing a menu on pressing the Menu button of the Android device. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 1896 | P | Handling Choice Selection in a Menu. |
After Creating a custom menu, implementing a reaction on clicking the menu item. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 2089 | P | Creating a Submenu. |
Display options to the user in an floating window. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 1885 | P | Creating and Using Dialogs |
You need to prompt the user of some event or state which requires immediate confirmation or a choice. For example, if the user tries to move away from a page with unsaved changes and you don't want to sae them automatically, you might prompt the user for what to do. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 1925 | P | Use a Timepicker widget |
Sometimes we need to ask the user to enter the time for processing some element in the application.
Accepting time in Text boxes is not graceful as well as requires validation. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 883 | P | iPhone-like wheel picker for selection |
Want a selection UI component similar to iPhone wheel picker. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 1746 | P | Creating a Tabbed Dialog |
Categorizing information display in an custom Dialog. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 2254 | P | Creating a ProgressDialog in Android. |
Making the user aware of background processing happening in the application. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 1728 | P | Creating a Custom Dialog with buttons, images and text |
Using a custom dialog in the application. The dialog is provided with text, images, buttons and also providing tabs in the dialog. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 3448 | P | A Re-usable About Box Class |
About Boxes are common in any application it is useful not to have to recode them for each new App. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 2334 | P | Customizing the Look of a Toast |
You want to customize the look of Toast notifications. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 795 | P | Creating a Notification in the Status Bar |
You want to place a notification icon in the notice bar at the top of the screen, to call the user's attention to an event that occurred or to remind them of a service that is running in the background. |
| GUI Alerts: Menus, Dialogs, Toasts and Notifications | 4254 | P | Using ActionBar on older Devices |
The ActionBar component, introduced in Honeycomb and upgraded in ICS, is a combination of a titlebar, menu items that get promoted to buttons, and a Menu Button to replace the hardware button that is absent in almost all 3.0+ devices. This is good functionality, and it would be nice to be able to use it on pre-4.x devices. |
| Other (temporary holder) | 3947 | N | Introduction: "Other" Category |
N/A |