Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art
Recipe List
PrefaceNRECIPE 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.
PrefaceNAuthor's Guide: How to Write Cookbook RecipesThere 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.
PrefaceNAsciiDoc Markup (WORK IN PROGRESSS; DO NOT USE)Every wiki site seems to accept a slightly different subset of the Wiki language [http://en.wikipedia.org/wiki/WikiWikiWeb originated in 1995 by Ward Cunningham], and later adopted by Wikipedia and others. Here's how this site works in this regard.
PrefacePAbout O'Reilly CookbooksWhat is special about the O'Reilly Cookbook Series?
PrefaceNRecommended Android Web SitesN/A
Getting StartedPCreating a "Hello, World" Application from the Command LineYou want to create a new Android project without using the Eclipse ADT plug-in.
Getting StartedPCreating a "Hello, World" Application using EclipseYou want to use Eclipse to develop your Android application.
Getting StartedNGetting ScreenshotsYou need a standard way of getting screenshots for use in the Android Cookbook or any other documentation.
Getting StartedPLearning the Java LanguageAndroid 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 StartedNPreparing the development environment.Preparing the development environment.
Getting StartedPSharing Java Classes from Another Eclipse ProjectYou want to use a class from another project, but don't want to copy-and-paste
Getting StartedNInstalling apps onto an Android EmulatorApp 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 StartedPUnderstanding the Android Activity Life CycleAndroid apps do not have a "main" method; you need to learn how they get started and how they stop or get stopped.
Getting StartedPProgram: A Simple CountDownTimer ExampleRequire a simple count down timer
Getting StartedPSetting Up Android StudioYou want to develop your Android applications using Android Studio, so a concise guide to setting up that IDE is useful.
Getting StartedPKeeping the Android SDK UpdatedThe SDK must be kept updated to allow App developers to work with the latest APIs on the evolving Android platform.
Getting StartedPUsing SDK Samples to Help Avoid Head ScratchingSometimes it is a struggle to code up some functionality, especially when the documentation is sketchy or does not provide any examples.
Getting StartedPInstalling .apk Files onto an Emulator via the ADBYou 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 StartedPTaking a Screenshot/Video from the Emulator/Android DeviceTaking a screen-shot of the application running on an Android Device.
Getting StartedPIntroductionN/A
Getting StartedPProgram: Tipster, a Tip Calculator for the Android OSA 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 StartedPReferencing Libraries to Implement External FunctionalityYou need to reference an external library in your Android source project
Getting StartedNGetting the source code of Android itselfHow did they do that?
Getting StartedPCreating a "Hello, World" App with Apache MavenYou want to build an Android app using Maven to handle the administrivia.
Getting StartedNLearning About Android ReleasesYou keep hearing about Gingerbread, Ice Cream Sandwiches, and Jelly Beans, and need to know what it all means.
Getting StartedNHello World - Android Studio VersionYou want to use Android Studio to develop your Android application.
Getting StartedPFiling a Bug Report about Android itselfYou think you've found a bug in Android.
Getting StartedNAndroid 5 User TutorialYou (or your friends, colleagues, testers, etc.) need to know to use Android 5
Getting StartedPBecoming an Android DeveloperYou want to become an Android Developer, and want to know what the stages of growth are.
Getting StartedPChoosing an IDE for Android DevelopmentYou want to choose one IDE to use for your Android projects: Android Studio, Eclipse, or "other".
Getting StartedPSetting Up Eclipse with AndMore (Replacing ADT)You want to keep using Eclipse for Android, even though Google's official IDE is based on IntelliJ
Getting StartedPUpgrading a Project from Eclipse ADT to Eclipse AndMoreYou have projects that were based on Eclipse ADT and want to use them with Eclipse AndMore
Getting StartedNInstalling the Eclipse Marketplace Client in your EclipseSome installations of Eclipse include the Marketplace Client (MPC), but some do not. Since MPC is the easiest way to install new plugins into Eclipse, we document it here.
Getting StartedPConverting an Eclipse ADT Project to Android StudioYou have existing Eclipse/ADT projects but want to or have to use Android Studio.
Getting StartedPCreating a "Hello, World" App using Android StudioYou want to use Android Studio to develop your Android application.
Getting StartedPUsing Java 8 Features in Android Studio 2You are using Java 8, the current version of Java as of 2015, in your other work and would like to use it in Android as well.
Getting StartedPUnderstanding the Android Application ArchitectureLots of moving parts.
Getting StartedPUsing the Compatibility LibrariesYou want to use new features of Android but have your application run correctly on older versions.
Getting StartedPPreserving History while Converting from Eclipse to Android StudioAs shown in <>, the Android Studio 'import' mechanism creates a new project in a new directory, causing a break in your revision control history. You want instead to convert a project permanently from Eclipse to Android Studio, but without losing years of valuable source control history.
Getting StartedPBuilding an Android Application both with Eclipse and with Android StudioN/A
Getting StartedPEliminating the unused "app/" directory path in Android Studio ProjectsYou do not like the useless "app/" directory indirection that Android Studio sets up for every new project.
Designing a successful ApplicationPException HandlingJava 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 ApplicationPKeeping Data When the User Rotates the DeviceWhen 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 ApplicationPAccessing 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 ApplicationPUsing Google Analytics in an Android ApplicationOften 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 ApplicationPMonitoring the Battery Level of an Android DeviceYour 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 ApplicationPCreating Splash Screens in AndroidMost applications require an introductory opening screen.
Designing a successful ApplicationPSplash Screens in Android: Method 2Most applications require an introductory opening screen.
Designing a successful ApplicationPDesigning a Conference/Camp/Hackathon/Institution AppYou want to design an app for use at a Conference, BarCamp, or Hackathon.
Designing a successful ApplicationPIntroduction: Designing a Successful Android ApplicationN/A
Designing a successful ApplicationNPreserving Activity StateUsers 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 ApplicationPA Simple Torch/FlashlightYou want to use your smart phone as a torch lamp/flashlight when there is no light or a power failure.
Designing a successful ApplicationPSetting First-Run PreferencesYou 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 ApplicationPAdapting an Android Phone Application to Be Used on a TabletI 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 ApplicationPUsing Hints Instead of Tool TipsAndroid devices can have small screens, there may not be room for help text, and tooltips are not part of the platform.
Designing a successful ApplicationPBacking Up Android Application DataIf 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 ApplicationPFormatting the Time and Date for DisplayI want to display the date and time in different standard formats. What is the the easiest approach to achieve this?
Designing a successful ApplicationPControlling Input with KeyListenersMy 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 ApplicationNUse Reflection to Safely Access Version-dependent APIYou 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.
Designing a successful ApplicationNOnboarding - The Welcome ProcessMost 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 ApplicationNGetting the device user's name, email, cell#Many apps need the device's name, email, and/or cell phone number. If you make the user re-type these, you are wasting their time, violating the "don't repeat yourself" principle.
Designing a successful ApplicationPLooking Good with Material DesignMaterial Design is Android's new visual paradigm for application development, or as they put it "a comprehensive guide for visual, motion, and interaction design across platforms and devices". Material Design looks way different from previous Android versions. You need to make your apps look great using this set of visual approaches.
Designing a successful ApplicationPRequesting Android Permissions at Run TimeIn Android 6 and later, you must check permissions at runtime in addition to specifying them in the manifest.
Designing a successful ApplicationPOptimizing the UI with Application ShortcutsYou want the user to be able to jump directly to activities within your application
TestingPDoing Test-Driven Development (TDD) in AndroidLack of mocking support making TDD Android App cumbersome.
TestingPTroubleshooting Application CrashesYour app crashes and you are uncertain as to why.
TestingPDynamic Testing with the Monkey ProgramNot quite the Turing test, but if your app can pass the monkey test, you deserve a pat on the back.
TestingPKeeping Your App Snappy with StrictModeMaking 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.
TestingPSetting Up an Android Virtual Device (AVD) for App TestingSuccessful Apps must run on a wide range of Android devices and versions.
TestingPDebugging Using Log.d and LogCatMany a times even though the Java code compiles without error, running the application crashes giving a 'Force Close' (or similar) error message.
TestingPIntroduction: TestingN/A
TestingPSending Text Messages and Placing Calls Between AVDsYou have made an app which needs to place or listen for calls or send or receive text messages and you want to test this.
TestingPReproducing Activity Life-Cycle Scenarios for TestingApps should be resilient to the Activity Lifecycle. Developers need to know how to reproduce different lifecycle scenarios.
TestingPGetting Bug Reports from Users Automatically with BugSenseUsers 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.
TestingPTesting with Eclipse and JUnitYou need to create and use a new Test Project to test your Android application.
TestingPTesting on a Huge Range of Devices with Cloud-based TestingYou need to test your app on a wide variety of devices.
TestingPUsing a Local Runtime Application Log for Analysis of Field Errors or SituationsUsers 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.
TestingPStatic Code Testing with Android LintYour code looks OK, but you want to see if it passes muster when subjected to expert scrutiny.
TestingPUnit Testing with Robolectric and JUnit 4.xYou like unit testing, but Android's test framework is based on the ancient Android 3.8, and it runs the full emulator so it's slow.
TestingPBDD acceptance ("Feature") Testing with Calabash (Cucumber)You want to use the [http://cukes.info/ Cucumber]-style of feature-based testing on your Android app.
TestingPTesting with ATSL, Espresso and JUnit 4You want to use the latest official testing software
TestingPTesting with Android Studio and JUnitYou want to use JUnit to test your Android Studio-based application.
TestingNList of Application Crash Reporting PackagesYou want a comparison of the different crash-reporting packages.
Graphical User InterfacePUnderstanding and Following User Interface GuidelinesLots of developers, even good ones, are very bad at user interface design.
Graphical User InterfacePFormatting NumbersYou 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 InterfacePFormatting with Correct PluralsYou'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 InterfacePFeeding AutoCompleteTextView Using an SQLite Database QueryAlthough 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 InterfacePChanging the Enter Key to "Next" on the Soft KeyboardSeveral 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 InterfacePCreating a Simple App WidgetWidgets 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 InterfacePMaking a View ShakeYou want a View component to shake for a few seconds to catch the user's attention.
Graphical User InterfacePUsing CheckBoxes and RadioButtonsYou want to offer the user a set of choices that is more limited than a list.
Graphical User InterfaceNAutocompletion with Icons/ImagesSearching 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 InterfaceNSimple CalendarYou desire a simple and native Month view Calendar, which can easily be skinned.
Graphical User InterfaceNSlidingDrawer Overlapping other UI componentsYou want the SlidingDrawer to overlap other UI components eg. ListView
Graphical User InterfacePCustomize 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 InterfacePIntroduction: GUIN/A
Graphical User InterfacePAndroid 3.0 Photo GalleryDisplay a photo gallery
Graphical User InterfacePBuilding a UI Using Android 3.0 Fragments in Android 1.6 and LaterYou 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 InterfacePProviding Haptic FeedbackBuilding 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 InterfacePHandling Configuration Changes by Decoupling the View from the ModelWhen 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 InterfacePCreating a Button and Its Click Event ListenerYou need to do something when the user presses a Button.
Graphical User InterfacePLet Them See Stars: Using RatingBarYou 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 InterfacePCreating a Custom Title BarYou cannot have any buttons or any custom text in the standard title bar.
Graphical User InterfacePCreating a Loading Screen That Will Appear Between Two ActivitiesIf you are getting an black screen before loading an activity here's how to avoid it.
Graphical User InterfaceNStarting a Second Screen from the FirstNew App developers need a simple example on how to open another screen, thus understanding how Android handles UI creation.
Graphical User InterfacePNavigating Different Activities Within a TabViewYou want to move from an activity within a tab view to another activity within the same tab.
Graphical User InterfacePEnhancing UI Design Using Image ButtonsWhile 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 InterfacePConstraining EditText Values with Attributes and the TextWatcher InterfaceThere is a need to limit the range and type of values being input.
Graphical User InterfacePImplementing AutoCompleteTextViewSave the user from typing entire words, instead auto-complete the entries.
Graphical User InterfacePUsing SlidingDrawer to Overlap Other ComponentsThe 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 InterfacePProcessing Key-Press Events in an ActivityIntercepting the keys pressed by the user and performing actions corresponding to them.
Graphical User InterfacePAdding a Border with Rounded Corners to a LayoutThere is a need to put a border around an area of the screen or add interest to a user interface.
Graphical User InterfacePWiring Up an Event Listener in Five Different WaysDevelopers 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 InterfaceNPortrait or Landscape? Both!An Activity's screen should be useable in both portrait and landscape modes.
Graphical User InterfacePDetecting Gestures in AndroidYou want to traverse through different screens using simple gestures like flip/scroll the page.
Graphical User InterfacePTurning Edit Fields into Password FieldsYou need to designate an EditText as a password field, so that characters the user types will not be visible to "shoulder surfers".
Graphical User InterfacePOffering a Drop-Down Chooser via the Spinner ClassYou want to offer a drop-down choice item.
Graphical User InterfacePHandling Long-Press/Long-Click EventsYou want to listen for long press / long click events and react to them, without having manually to check for multiple events.
Graphical User InterfaceNCreating your own Custom Button StyleYou need to create your own custom button style for all your application buttons.
Graphical User InterfacePDisplaying Text Fields with TextView and EditTextYou want to display text on the screen, either read-only or editable.
Graphical User InterfaceNUsing Existing/Standard DrawablesYou want to use existing drawables where possible to give your app a look that is consistent with standard Android.
Graphical User InterfaceNUsing a Compound DrawableHow do I use a "compound drawable", a TextView that contains an ImageView in addition to its text?
Graphical User InterfaceNUsing Transitions Between ActivititiesYou want to assume control for the transitions between Activities, instead of allowing the default "instant" transition.
Graphical User InterfaceNChange the Text Size for a SpinnerA Spinner is not like a TextView, the textSize attribute will not work (a Spinner is a ViewGroup).
Graphical User InterfaceNCustom LayoutsThis is a placeholder recipe for some ideas on layout management aka ViewGroup
Graphical User InterfaceNPrevent flickering when user performs scrolling on a viewHow 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 InterfaceNChoosing a Layout Manager (ViewGroup) and Arranging ComponentsYou want to know how to arrange your GUI components within your view.
Graphical User InterfaceNAdding a Share Action to your ActionBarYou want to add the standard Share icon to your ActionBar and have it handle an application-provided Intent.
Graphical User InterfacePSliding Between Views with a ViewPagerYou have a variety of similar view pages and want the user to be able to swipe or slide sideways to navigate from one to the next.
Graphical User InterfacePCreating a Custom View GUI ComponentYou want to create a custom View component
Graphical User InterfacePCreating a Tabbed Activity that is tappable and swipableYour UI is too complex to fit comfortably in a single Activity, but you don't want to break it down into multiple discrete Activities. And you want the user to have the flexibility to either tap on Tabs or to swipe left/right to navigate between sections.
Graphical User InterfacePBuilding Modern UIs with the Fragment APIT/K
Graphical User InterfaceNUsing Card WidgetsCard Widgets are a relatively new form of UI control, and you want to learn when and how to use them.
Graphical User InterfaceNUsing FloatingButtons and FloatingActionBarTK
Graphical User InterfacePControlling the ActionBarThe ActionBar is an important part of most modern Android applications. You need to know how to create, configure, and, when necesssary, hide, the ActionBar.
GraphicsPTaking a Picture Using an IntentYou want to take a picture from within your app and don't want to write a lot of code.
GraphicsPCreating HTML5 Charts with Android RGraphNeed to visualize data in a chart and ability to interaction with the plot/chart via Javascript.
GraphicsPUsing a Custom FontThe range of fonts that comes with Android 2.x is amazingly miniscule - three variants of the "Droid" font. You want something better.
GraphicsPTaking a Picture Using android.media.CameraYou want to have more control on the various stages involved when taking a picture.
GraphicsPAdding Controls to the OpenGL Spinning CubeYou want to interact with an OpenGL polygon using the keyboard of your device.
GraphicsPDrawing a Spinning Cube with OpenGL ESYou want to create a basic OpenGL ES application.
GraphicsPIntroduction: GraphicsN/A
GraphicsPCreating Easy Launcher Icons from OpenClipArt.org Using Paint.NETA 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.
GraphicsPUsing Pinch to ZoomUse 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.
GraphicsPUsing AndroidPlot to Display Charts and GraphsDepicting data graphically in an Android application.
GraphicsPUsing Inkscape to Create an Android Launcher IconEvery good Android App deserves a custom launcher icon.
GraphicsPAdding a Simple Raster AnimationThere is a need to add an animated image to a screen.
GraphicsNImageButton State Graphics Using InkscapeYou need to add interest to a screen with custom buttons.
GraphicsPUsing Nine Patch FilesWhen 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.
GraphicsPScanning a Barcode or QR Code with the Google ZXing Barcode ScannerYou want your App to be able to scan a Barcode or QR Code.
GraphicsPFreehand Drawing Smooth CurvesYou want to allow the user to draw smooth curves, such as freehand bezier curves, legal signatures, etc.
GraphicsPGraphing with a Charting PackageYou need charts or graphs, but don't want to write a lot of code.
MultimediaPUsing Speech to TextHow to get speech input and display it as text
MultimediaPCapturing Video Using MediaRecorderYou want to grab a video using the built-in device camera and save it to disk.
MultimediaPPlaying a YouTube VideoYou want to play a video from Youtube on your device
MultimediaPPlaying Audio from a FileYou want to play an audio file stored on the device.
MultimediaPUsing Android's Face Detection CapabilityFace 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.
MultimediaPUsing the Gallery with the ImageSwitcher ViewCreating UI for browse through multiple images.
MultimediaPPlaying Audio Without InteractionYou want to play an audio file with no interaction.
MultimediaPMaking the Device Speak with Text-to-SpeechYou want your application to pronounce words of text so the user can perceive them without watching the screens (e.g., when driving).
MultimediaPIntroduction: MultimediaN/A
MultimediaNPlaying a Video in your AppYou want to play a Video in your application, as opposed to launching a media player application using an Intent (as shown in [[1651]]).
MultimediaNPreparing an App for Google TVWhile many phone/tablet apps can run on Google TV devices, there are packaging requirements and some considerations.
MultimediaPCreate and Share data in PDF formatYou want to create a PDF document and save it and/or share it.
MultimediaPImplementing Drag and DropYou want to implement drag-and-drop, similar to what the Home Screen / Launcher does when you long-press on an application icon.
Data PersistencePParsing an XML Document Using the DOM APIYou have data in XML, and you want to transform it into something useful in your application.
Data PersistencePIntroduction: Data PersistenceN/A
Data PersistencePAdding a Contact through the Contacts Content providerYou have some contact information that you want to save for use in the Contacts application.
Data PersistencePListing a DirectoryYou need to list the filesystem entries named in a directory.
Data PersistencePWorking with Dates in SQLiteAndroid'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 PersistenceNStoring and Retrieving Data with a Content ProviderYou need to store and retrieve data, and there is a Content Provider that you can use.
Data PersistencePChecking the Consistency of Default Shared PreferencesAndroid 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 PersistencePPerforming Advanced Text Searches on an SQLite DatabaseHow to build a data layer to store and search text data using wildcards or expressions like and, or, not, etc.
Data PersistencePGetting Space Information About the SD CardYou want to find out the amount of total and available space on the SD card
Data PersistencePWriting a Content ProviderOften 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?
Data PersistenceNParsing JSON using the Jackson ParserParse JSON using Jackson parser
Data PersistencePUsing an SQLite Database in an Android ApplicationData persistence in the application.
Data PersistencePRetrieving data from a SQLite database.Loading items from an existing SQLite database.
Data PersistencePInserting values into a SQLite database.Adding values into a SQLite database.
Data PersistencePParsing JSON Using JSONObjectMany websites provide data in JSON. Many applications require to parse JSON and provide that data in the application.
Data PersistenceNParsing an XML document using an XmlPullParserYou have data in XML, and you want to transform it into something useful in your application.
Data PersistencePReading a File Shipped with the App Rather Than in the FilesystemYou need to access data stored in a file in /res/raw directory.
Data PersistenceNSave Data in the cloud with CouchDB and EktorpYou want to persist data locally and have it backed to a persistence store in the cloud.
Data PersistencePStoring and Retrieving Data via a Content ProviderYou want to read from a Content Provider such as Contracts.
Data PersistencePReading Contact Data Using a Content ProviderYou need to extract details, such as a phone number or email address, from the Contacts database.
Data PersistencePGetting File and Directory InformationYou need to know all you can about a given file "on disk", typically on internal memory or on the SD Card.
Data PersistencePProviding User Preference Activity with Minimal EffortYou want to let the user specify one or more preferences values, and have them persisted across runs of the program.
Data PersistenceNAdding Calendar EventsYou want to add an event to the user's on-device calendar.
Data PersistencePUpgrading an Existing SQLite DatabaseYou want to provide an orderly upgrade to the SQLite database schema on your database, without losing data or causing errors on users who upgrade to a newer version of your app.
Data PersistencePStoring Data In the Cloud with Google FirebaseYou need to store data from your app users' devices in the cloud, and don't have time to write a Sync Adapter.
Data PersistencePBacking your SQLite Data to the Cloud with a SyncAdapterYou want your SQLite or Content Provider data to be bi-directionally synchronized with a database running on a server
Data PersistencePExposing non-SQL data as an SQL CursorYou have non-SQL data, such as a list of files, and want to present it as a Cursor
Data PersistenceNDisplaying Data with a CursorLoaderYou need to load information via a Cursor and load it into a Graphical User Interface with correct use of threads to avoid blocking the UI thread.
Data PersistencePReading and Writing Files in Internal and External StorageFiles can be created and accessed in several different places on the device, notably, application private data and "sd-card" style data. You need to learn the APIs for dealing with these sections of the filesystem.
Data PersistencePUsing Internal vs External StorageYou want to know how to store files in internal vs external storage.
Data PersistencePSharing Files with a FileProviderYou want to share internal-storage files (see <>) with another app, without the bother of putting the data into a Cursor and creating a ContentProvider.
Telephone ApplicationsPDoing Something When the Phone RingsYou want to act on an incoming phone call and do something with the incoming number.
Telephone ApplicationsPProcessing Outgoing Phone CallsYou want to block certain calls, or alter the phone number about to be called.
Telephone ApplicationsPDialing the PhoneYou want to dial the phone from within an application, without worrying about details of telephony.
Telephone ApplicationsPReceiving an SMS Message in an Android ApplicationEnabling your application to receive an SMS.
Telephone ApplicationsPUsing Emulator Controls to Send SMS Messages to the EmulatorFor testing SMS based applications sending SMS to the emulator.
Telephone ApplicationsNGetting Phone Details.Some Android applications require the Android device's IMEI number, the phone number or the phone type (GSM/CDMA).
Telephone ApplicationsPSending Single-Part or Multipart SMS MessagesA simple way to send either a single part or a multipart (handing the message concatenation UDH) from a single entry point
Telephone ApplicationsPUsing Android's TelephonyManager to Obtain Device InformationI want to obtain network related and telephonic information on my phone. How to do this?
Telephone ApplicationsPIntroduction: Telephone ApplicationsN/A
Networked ApplicationsPIntroduction: NetworkingN/A
Networked ApplicationsPConsuming a RESTful Web Service using URLConnectionYou need to access a RESTful Web Service.
Networked ApplicationsPExtracting Information from Unstructured Text Using Regular ExpressionsYou want to get information from another source, but they don't make it available as information, only as a viewable web page.
Networked ApplicationsPParsing RSS/Atom Feeds Using ROMEYou want to parse RSS/Atom feeds.
Networked ApplicationsPWriting an Inter-Process Communication ServiceHow to write remote service in the android? How to access it from other application?
Networked ApplicationsPAccessing a Web Page Using WebViewOpening a website within your application.
Networked ApplicationsPCustomizing a WebViewYou need to customize the WebView opened by your application.
Networked ApplicationsPConverting Text into HyperlinksYou need to make webpage URLs into hyper-links in a TextView of your Android app
Networked ApplicationsNSending an Email using IntentsYou need to send an Email through your application
Networked ApplicationsPUsing MD5 to Digest Clear TextSometime 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 ApplicationsNSimple HTTP client functionsHow to access services over HTTP fcrom a handset application
Networked ApplicationsNUsing Google Cloud Messaging (GCM) "Push Messaging" to Alert Your App to ChangesYou want to get "push" notifications sent asynchronously from a server, without setting you your own complex infrastructure. This can be used to send short data (up to about 4KB), or to send a "ping" notification which will cause the app to download new data from your server.
Networked ApplicationsPConsuming a RESTful Web Service with VolleyYou want an easy way to access a REST service and have heard that Volley might be the answer.
Social NetworkingPIntroduction: Social NetworkingN/A
Social NetworkingNFacebook IntegrationIntegrate an Android application with Facebook
Social NetworkingPIntegrating Social Networking Using HTTPInstead of diving into the API you can simply add Social networking support.
Social NetworkingPLoading a User's Twitter Timeline Using JSONYou want to load the Twitter timeline of a user in an Android application.
Social NetworkingPSimplifying Date/Time Calculations with Date4JYou want a simple, sensible Date/Time API.
Social NetworkingPUsing OAuth2 to connect to social networksMost popular social networks use OAuth2, so you will probably need to connect to it sometime.
Location and Map ApplicationsPGetting Location InformationYou want to know where you are.
Location and Map ApplicationsNHandling longpress in a mapFor 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 ApplicationsNMapView inside TabViewYou want to place a MapView object within TabView. Target application outline * Draw two empty tabs * Show map on the first tab [[Image:MapTabView_screenshot.png]]
Location and Map ApplicationsNHow to show your current location in a mapYou want to see where you are in a map using the built-in GPS in Android devices
Location and Map ApplicationsPMocking GPS Coordinates on a DeviceYou 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 ApplicationsNUsing Google Maps in your Android AppSometimes 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 ApplicationsNGetting ready for Google Maps API V1 developmentYou want to get ready to include Google MapView layout elements in your Android app
Location and Map ApplicationsNDraw overlay icon without using DrawableHow can you display an map overlay in MapView without using Drawable objects?
Location and Map ApplicationsPUsing Geocoding and Reverse GeocodingHow to Geocode and Reverse Geocode on Android
Location and Map ApplicationsNDraw a location marker on a Google MapViewYou have a geo location and you want to display it on a Google MapView view object
Location and Map ApplicationsPAccessing GPS Information in Your ApplicationYou need access the GPS location in any class of your application.
Location and Map ApplicationsNLocation search on Google mapsDoing a location search using Google Maps.
Location and Map ApplicationsNCreating Overlays for a Google MapViewDemarcating a point on a Google map using an image.
Location and Map ApplicationsNTo Add Device's current location to Google MapsAdding Current location of the device on Google maps.
Location and Map ApplicationsNChanging Views of a MapView.Showing an appropriate view of a MapView based on the context in the application.
Location and Map ApplicationsNDrawing multiple location markers on a MapViewYou have several GeoPoints which you want to display on a Google MapView.
Location and Map ApplicationsNDraw your current location on a Google MapViewYou 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 ApplicationsPUsing OpenStreetMapYou want to use OpenStreetMap (OSM) map data to display maps in your application.
Location and Map ApplicationsPCreating Overlays in OpenStreetMap MapsYou need to create overlays for your OpenStreetMap
Location and Map ApplicationsPHandling Touch Events on an OpenStreetMap OverlayYou need to perform actions when the overlay on an OpenStreetMap is tapped
Location and Map ApplicationsPUsing a Scale on an OpenStreetMap MapYou need to show a map scale on your OSM to indicate the level of zoom on the MapView
Location and Map ApplicationsPGetting Location Updates with OpenStreetMap MapsYou need to react to the changes in the device's location and move the map focus to changed location
Location and Map ApplicationsPIntroduction: Location-Aware ApplicationsN/A
Location and Map ApplicationsPGetting Ready for Google Maps API V2 DevelopmentYou want to get set up to use the current (V2) Google Maps API.
Location and Map ApplicationsPUsing the Google Maps API V2Now that you've set up your environment as in [[4285]], you want to do something with the Maps API.
Accelerometer and other SensorsPUsing the Accelerometer to Detect Shaking of the DeviceSometimes 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 SensorsPChecking for the Presence or Absence of a SensorBefore 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 SensorsPChecking Whether a Device Is Facing Up or Facing Down Based on Screen Orientation Using an AccelerometerCheck for the orientation (Facing up/Facing Down) of the Android device.
Accelerometer and other SensorsPIntroduction: SensorsN/A
Accelerometer and other SensorsPFinding the Orientation of an Android Device Using an Orientation SensorBeing able to detect which side of the android device is higher up compared to the rest (Top/Bottom/Right/Left side)
Accelerometer and other SensorsPReading the Temperature SensorYou need to get temperature values using the temperature sensor.
BluetoothPImplementing Bluetooth Device DiscoveryYou want to display a list of Bluetooth devices in the vicinity.
BluetoothPConnecting to a Bluetooth-Enabled DeviceYou need to connect to other bluetooth enabled device and want to communicate with it.
BluetoothPEnabling Bluetooth and Making the Device DiscoverableIf 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.
BluetoothPAccepting Connections from a Bluetooth DeviceCreating a listening server for Bluetooth Connections.
BluetoothPIntroduction: BluetoothN/A
Other Programming LanguagesPRunning Native C/C++ Code with JNI on the NDKYou 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 LanguagesPGetting Started with the Scripting Layer for Android (SL4A, 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 LanguagesPIntroduction: Other Programming LanguagesN/A
Other Programming LanguagesNRunning Adobe Air/Flex on AndroidDeveloping AIR/Flex Apps for Android.
Other Programming LanguagesNRunning an External/Native Unix/Linux CommandSometimes 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 LanguagesNIntro to Flex 4.5 Android ProgrammingCreating 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 LanguagesPUsing Native Handset Functionality from WebView via JavaScriptThe 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 LanguagesNInstalling and Using Android Scripting Environment (ASE)You need to run scripts (python, perl, lua etc) on an Android device.
Other Programming LanguagesNMaking a Toast in Python (Using Android Scripting Environment)You need to make a Toast using python (Using ASE)
Other Programming LanguagesPFetching Your Google Documents and Displaying Them in a ListView Using SL4AYou need to get the details of your Google documents after logging in with your Google ID and password.
Other Programming LanguagesPCreating Alerts in SL4AYou need to create an alert box or pop-up dialog using Python in the Scripting Layer for Android (SL4A)
Other Programming LanguagesNCreating notifications in ASEYou need to create a notification using python in Android Scripting Environment
Other Programming LanguagesPSharing SL4A Scripts in QR CodesYou need to distribute your ASE scripts using QR (Quick Response) Codes
Other Programming LanguagesNEasy Apps with App Inventor (placeholder recipe)You want to generate Android applications without needing to write either Java code or HTML.
Other Programming LanguagesPCreating a Platform-Independent Application Using PhoneGap/CordovaYou want an application to run on different platforms like iOS, Android, BlackBerry, Bada, Symbian, Windows etc.
Other Programming LanguagesNPhoneGap (Android) Accessing your java files from javascriptYou need to access your methods from Activity.java in JavaScript
Other Programming LanguagesNPhoneGap (Android) Using JQuery MobileYou need to use JQuery mobile in your Mobile App (since it is platform independent).
Other Programming LanguagesNCross-Platform Development SummaryYou need to run your app on Android and on other major platforms, and don't wish to rewrite it from scratch for each one.
Other Programming LanguagesPLearning About Cross-Platform SolutionsThere is no central list of the various development environments and languages available to build Android Apps.
Other Programming LanguagesPCreating a Platform-Independent Application Using XamarinN/A
Other Programming LanguagesPCreating a Platform-Independent Application with React.NativeN/A
Strings and InternationalizationPIntroduction: InternationalizationN/A
Strings and InternationalizationPInternationalizing Application TextYou want the text of your buttons, labels and so on to appear in the user's chosen language.
Strings and InternationalizationPHandling the Nuances of strings.xmlEntering text in strings.xml on most occasions is easy enough, but sometimes peculiar results crop up.
Strings and InternationalizationPFinding and Translating StringsYou need to find all the strings in your application, internationalize them, and begin the process of translating them.
Strings and InternationalizationPSimplifying Date/Time Calculations with the Java 8 java.time API (nee Joda-Time, JSR-310)You've heard that JSR-310 date/time API, included in Java SE 8, simplifies date and time calculations, and you'd like to use it in Android.
Packaging, deploying and sellingPIntroduction: Packaging, Deploying, and DistributingN/A
Packaging, deploying and sellingPDistributing Your Application via Android Play (formerly the Android Market)You want to give away or sell your application via the Android Market.
Packaging, deploying and sellingPCreating a Signing Certificate and Using it to Sign Your ApplicationYou want to publish an application, and you need a "signing key" to complete the process.
Packaging, deploying and sellingPSigning Your ApplicationYou want to sign your application prior to uploading it to the Android Market.
Packaging, deploying and sellingPMonetizing Your App with AdMobYou want to monetize your free app by showing ads within it.
Packaging, deploying and sellingPObfuscating and Optimizing with ProGuardYou want to obfuscate your code, or optimize it (for speed or size), or all of the above.
Packaging, deploying and sellingNBuilding your App as an Open Source ProjectYou want to build your Android App as an open source project, building it collaboratively with a vibrant community of developers.
Packaging, deploying and sellingPProviding a Link to Other Published Apps in the Google Play MarketYour 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 sellingNMerging 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 sellingNPassing Android Code AroundThere are plenty of code samples around, this site included, a clean way to use (and generate) example code is needed.
Packaging, deploying and sellingNRunning Android Apps on the BlackBerry 10 PlatformYour App works fine on real Android devices, and you're ready to move it to the next easy target: the BlackBerry Android Player.
Packaging, deploying and sellingNGetting your Android App into BlackBerry AppWorldOnce you have your app running on a real PlayBook tablet as discussed in [[3961]], you want to distribute it to BlackBerry's user base.
Packaging, deploying and sellingNAlternate Home Screen (Kiosk Mode Phone)You need to provide an alternate home screen for your phone.
Packaging, deploying and sellingPList of Android MarketplacesThere are many Android stores now.
Packaging, deploying and sellingPAuto update /self-updating appYour app is not in Google Play or another full-featured market but you still want users to get updates when you improve the app.
Packaging, deploying and sellingPHosting Your App on a Private ServerN/A
Other GUI Elements: Lists and ViewsPBuilding List-Based Applications with ListViewMany 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.
Other GUI Elements: Lists and ViewsPWriting a Custom List AdapterLists 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.
Other GUI Elements: Lists and ViewsNListView with Icons/imagesYou want to display data in a ListView with an icon image and some text for each ListView row.
Other GUI Elements: Lists and ViewsPHandling Orientation Changes: From ListView Data Values to Landscape ChartingAccomplish 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.
Other GUI Elements: Lists and ViewsPUsing Section Headers in ListViewsYou want to display categorized items e.g., by time/day, by product category or sales price.
Other GUI Elements: Lists and ViewsPCreating an Advanced ListView with Images and TextYou want to write a ListView that shows an image next to a string.
Other GUI Elements: Lists and ViewsNMaking Lists Behave NicelyLists are easy to get started with, but there are a lot of variations that will provide optimal user experience.
Other GUI Elements: Lists and ViewsPCreating a "No Data" View for ListViewsWhen 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.
Other GUI Elements: Lists and ViewsPIntroduction: ListViewN/A
Other GUI Elements: Lists and ViewsNAdd a Selection List when using AppCompatActivityYour App needs the use a list but the Activity uses AppCompatActivity.
Other GUI Elements: Lists and ViewsPKeeping the ListView with the User's FocusYou don't want to distract the user by moving the ListView to its beginning, away from what the user just did.
Other GUI Elements: Lists and ViewsNFiltering a ListView based on user inputYou want the contents of a ListView to update as a user types, to list only items matching the thus-far-entered portion of a name, email, etc.
Other GUI Elements: Lists and ViewsPUsing ListView with ListActivityYou want to use a ListView in a ListActivity.
Other GUI Elements: Lists and ViewsPBuilding Modern Lists with RecyclerViewRecyclerView is a modern re-interpretation of the classical List. You want to learn when and how to use the new paradigm.
Other GUI Elements: Lists and ViewsPUsing a SearchView to Search Through Data in a ListViewYou want a search box (with a magnifying glass icon and an "x" to clear the text) to filter the content displayed in a ListView
Gaming and AnimationPIntroduction: Gaming and AnimationN/A
Gaming and AnimationPBuilding an Android Game Using flixel-androidGame design
Gaming and AnimationPBuilding an Android Game Using AndEngine (Android-Engine)Game design and programming using the AndEngine game framework
Gaming and AnimationPProcessing Timed Keyboard InputTo 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 ControlPIntroduction: System and Device ControlN/A
System and Device ControlPAccessing Phone Network/Connectivity InformationYou want to find information about phones network connectivity
System and Device ControlNRebooting the DeviceFor some strange reason, you want the user's Android device to reboot.
System and Device ControlPMaking the Device VibrateThrough your application, you wish to notify the user of an event by means of device's vibration.
System and Device ControlPUsing LED-Based NotificationsSome Android phones are equipped with LEDs. An application can flash different color lights using the LED.
System and Device ControlPObtaining Information from the Manifest FileYou want to read project settings (e.b, app version) data from the AndroidManifest file during program execution.
System and Device ControlNRebooting the Device - The Hack WayIf you want to reboot an emulator, the hack way!
System and Device ControlPRunning Shell Commands from Your ApplicationYou need to run a shell command from your application (for instance pwd, ls etc).
System and Device ControlPDetermining Whether a Given Application Is RunningHow do i know if mine or some other app is running?
System and Device ControlPCopying Text and Getting Text from the ClipboardYou need to copy text to the clipboard and access the text stored on the clipboard
System and Device ControlPChanging Incoming Call Notification to Silent, Vibrate, or NormalYou need to put the Android device to silent, vibrate or normal mode
System and Device ControlNUsing SuperUser on Rooted DevicesYou need root access to do something (non-nefarious) on the user's behalf, and you're running on a 'rooted' device.
Inter/Intra-Application CommunicationPIntroduction: Inter-/Intra-Process CommunicationN/A
Inter/Intra-Application CommunicationPPushing String Values Using Intent.putExtra()You need to pass some parameters into an activity while launching it.
Inter/Intra-Application CommunicationPKeeping a Service Running While Other Apps Are on DisplayYou want part of your application to continue running in the background while the user switches to interact with other apps.
Inter/Intra-Application CommunicationPEmailing Text from a ViewYou 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 CommunicationPCreating an Android Epoch HTML/JavaScript CalendarYou require a custom calendar using Javascript. This recipe also shows how to interact between Javascript and Java.
Inter/Intra-Application CommunicationPRetrieving Data from a Subactivity Back to Your Main ActivityYour main activity needs to retrieve data from a sub activity.
Inter/Intra-Application CommunicationPSending Messages Between Threads Using an Activity Thread Queue and HandlerYou 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 CommunicationPSending/Receiving a Broadcast MessageYou want to make an activity which receives a simple broadcast messages sent by another activity
Inter/Intra-Application CommunicationPCreating a Responsive Application Using ThreadsHow to create a responsive application.
Inter/Intra-Application CommunicationNAsyncTask: Do background tasks and modify the GUIIf 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 CommunicationPSending an Email with AttachmentsYou want to send an e-mail with attachments.
Inter/Intra-Application CommunicationPOpening a Web Page, Phone Number, or Anything Else with an IntentThe 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 CommunicationPStarting a Service After Device RebootYou have a service in your app and you want it to start after the phone reboots.
Inter/Intra-Application CommunicationNIntercommunication amongst ApplicationsYou 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 CommunicationNEating Too Much CPU Time In The UI Causes A Nasty ResultAny 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 CommunicationPUsing AsyncTask to Do Background ProcessingYou 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 CommunicationNExchanging Array Data between Java and JavaScriptYou want to push array data from Java to JavaScript and/or from JavaScript to Java
Inter/Intra-Application CommunicationNReturning a value from an Activity to the Service that started itYour Service starts an Activity, which does something. Naturally you want to feed this updated value back to the service, which will know what to do with it.
Inter/Intra-Application CommunicationPUsing LocalBroadcastManager to Broadcast and Receive within your applicationYou want to use the Broadcast send/receive mechanism, but don't want other apps to see your broadcasts.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPCreating a Notification in the Status BarYou 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 NotificationsPCreating an iPhone-like Wheel Picker for SelectionWant a selection UI component similar to iPhone wheel picker.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPCreating a Custom Dialog with Buttons, Images, and TextUsing 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 NotificationsPCreating a Tabbed DialogCategorizing information display in an custom Dialog.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPCreating a Pop-up/Alert DialogYou 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 NotificationsPCreating and Displaying a MenuWithin the Activity, showing a menu on pressing the Menu button of the Android device.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPHandling Choice Selection in a MenuAfter Creating a custom menu, implementing a reaction on clicking the menu item.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPUsing a Timepicker WidgetSometimes 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 NotificationsPCreating a SubmenuDisplay options to the user in an floating window.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPCreating a ProgressDialogMaking the user aware of background processing happening in the application.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPCustomizing the Appearance of a ToastYou want to customize the look of Toast notifications.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPCreating a Reusable About Box ClassAbout 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 NotificationsPIntroduction: GUI AlertsN/A
GUI Alerts: Menus, Dialogs, Toasts and NotificationsPUsing ActionBar on older DevicesThe 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.
GUI Alerts: Menus, Dialogs, Toasts and NotificationsNAlerting the User with Toast and FloatingActionBarYou want to notify the user of some occurrence, using a short-lived notification on-screen mechanism.
Other (temporary holder)NIntroduction: "Other" CategoryN/A