Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art
Person Details for idarwin
Usernameidarwin
NameIan Darwin
Web Sitehttp://www.darwinsys.com/
Email(protected)
Location(protected)
Member Since2010-01-30 00:00:00.0
Last Seen2017-09-11 21:16:58.045
IdTitleProblem
5205 Eliminating the unused "app/" directory path in Android Studio Projects You do not like the useless "app/" directory indirection that Android Studio sets up for every new project.
5284 Optimizing the UI with Application Shortcuts You want the user to be able to jump directly to activities within your application
5204 Creating a Platform-Independent Application with React.Native N/A
5203 Building an Android Application both with Eclipse and with Android Studio N/A
5202 Creating a Platform-Independent Application Using Xamarin N/A
5201 Hosting Your App on a Private Server N/A
5188 Preserving History while Converting from Eclipse to Android Studio As shown in <<r4998>>, 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.
5177 Using the Compatibility Libraries You want to use new features of Android but have your application run correctly on older versions.
5175 Controlling the ActionBar The ActionBar is an important part of most modern Android applications. You need to know how to create, configure, and, when necesssary, hide, the ActionBar.
5173 Using OAuth2 to connect to social networks Most popular social networks use OAuth2, so you will probably need to connect to it sometime.
5168 Implementing Drag and Drop You want to implement drag-and-drop, similar to what the Home Screen / Launcher does when you long-press on an application icon.
5164 Alerting the User with Toast and FloatingActionBar You want to notify the user of some occurrence, using a short-lived notification on-screen mechanism.
5161 Using FloatingButtons and FloatingActionBar TK
5139 List of Application Crash Reporting Packages You want a comparison of the different crash-reporting packages.
5137 Testing with Android Studio and JUnit You want to use JUnit to test your Android Studio-based application.
5098 Using a SearchView to Search Through Data in a ListView You want a search box (with a magnifying glass icon and an "x" to clear the text) to filter the content displayed in a ListView
5080 Sharing Files with a FileProvider You want to share internal-storage files (see <<r5028>>) with another app, without the bother of putting the data into a Cursor and creating a ContentProvider.
5077 Using Internal vs External Storage You want to know how to store files in internal vs external storage.
5074 Testing with ATSL, Espresso and JUnit 4 You want to use the latest official testing software
5072 Building Modern Lists with RecyclerView RecyclerView is a modern re-interpretation of the classical List. You want to learn when and how to use the new paradigm.
5070 Using Card Widgets Card Widgets are a relatively new form of UI control, and you want to learn when and how to use them.
5068 Building Modern UIs with the Fragment API T/K
5058 Understanding the Android Application Architecture Lots of moving parts.
5056 Using Java 8 Features in Android Studio 2 You 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.
5028 Reading and Writing Files in Internal and External Storage Files 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.
5024 Consuming a RESTful Web Service with Volley You want an easy way to access a REST service and have heard that Volley might be the answer.
5022 Displaying Data with a CursorLoader You 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.
5017 Exposing non-SQL data as an SQL Cursor You have non-SQL data, such as a list of files, and want to present it as a Cursor
5009 Backing your SQLite Data to the Cloud with a SyncAdapter You want your SQLite or Content Provider data to be bi-directionally synchronized with a database running on a server
5007 Storing Data In the Cloud with Google Firebase You need to store data from your app users' devices in the cloud, and don't have time to write a Sync Adapter.
5000 Creating a "Hello, World" App using Android Studio You want to use Android Studio to develop your Android application.
4998 Converting an Eclipse ADT Project to Android Studio You have existing Eclipse/ADT projects but want to or have to use Android Studio.
4991 Installing the Eclipse Marketplace Client in your Eclipse Some 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.
4987 Upgrading a Project from Eclipse ADT to Eclipse AndMore You have projects that were based on Eclipse ADT and want to use them with Eclipse AndMore
4985 Setting Up Eclipse with AndMore (Replacing ADT) You want to keep using Eclipse for Android, even though Google's official IDE is based on IntelliJ
4909 Choosing an IDE for Android Development You want to choose one IDE to use for your Android projects: Android Studio, Eclipse, or "other".
4860 Becoming an Android Developer You want to become an Android Developer, and want to know what the stages of growth are.
4774 Android 5 User Tutorial You (or your friends, colleagues, testers, etc.) need to know to use Android 5
4734 Looking Good with Material Design Material 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.
4716 Auto update /self-updating app Your app is not in Google Play or another full-featured market but you still want users to get updates when you improve the app.
4690 List of Android Marketplaces There are many Android stores now.
4670 Getting 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.
4665 Creating a Tabbed Activity that is tappable and swipable Your 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.
4634 Simplifying Date/Time Calculations with Date4J You want a simple, sensible Date/Time API.
4622 Simplifying 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.
4601 Using Google Cloud Messaging (GCM) "Push Messaging" to Alert Your App to Changes You 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.
4586 Upgrading an Existing SQLite Database You 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.
4576 Create and Share data in PDF format You want to create a PDF document and save it and/or share it.
4573 Filing a Bug Report about Android itself You think you've found a bug in Android.
4547 Using LocalBroadcastManager to Broadcast and Receive within your application You want to use the Broadcast send/receive mechanism, but don't want other apps to see your broadcasts.
4543 Returning a value from an Activity to the Service that started it Your 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.
4512 Graphing with a Charting Package You need charts or graphs, but don't want to write a lot of code.
4491 Creating a Custom View GUI Component You want to create a custom View component
4483 Sliding Between Views with a ViewPager You 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.
4470 Using ListView with ListActivity You want to use a ListView in a ListActivity.
4464 Hello World - Android Studio Version You want to use Android Studio to develop your Android application.
4458 Cross-Platform Development Summary You need to run your app on Android and on other major platforms, and don't wish to rewrite it from scratch for each one.
4449 BDD acceptance ("Feature") Testing with Calabash (Cucumber) You want to use the [http://cukes.info/ Cucumber]-style of feature-based testing on your Android app.
4447 Unit Testing with Robolectric and JUnit 4.x You 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.
4426 Exchanging Array Data between Java and JavaScript You want to push array data from Java to JavaScript and/or from JavaScript to Java
4383 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.
4297 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.
4285 Getting Ready for Google Maps API V2 Development You want to get set up to use the current (V2) Google Maps API.
505 Storing and Retrieving Data with a Content Provider You need to store and retrieve data, and there is a Content Provider that you can use.
4254 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.
4247 Filtering a ListView based on user input You 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.
4233 Static Code Testing with Android Lint Your code looks OK, but you want to see if it passes muster when subjected to expert scrutiny.
4222 Choosing a Layout Manager (ViewGroup) and Arranging Components You want to know how to arrange your GUI components within your view.
4213 Learning About Android Releases You keep hearing about Gingerbread, Ice Cream Sandwiches, and Jelly Beans, and need to know what it all means.
4196 Preparing an App for Google TV While many phone/tablet apps can run on Google TV devices, there are packaging requirements and some considerations.
4137 Creating a "Hello, World" App with Apache Maven You want to build an Android app using Maven to handle the administrivia.
4135 Custom Layouts This is a placeholder recipe for some ideas on layout management aka ViewGroup
4124 Alternate Home Screen (Kiosk Mode Phone) You need to provide an alternate home screen for your phone.
4069 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]]).
4063 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.
3991 Using Transitions Between Activitities You want to assume control for the transitions between Activities, instead of allowing the default "instant" transition.
3969 Getting your Android App into BlackBerry AppWorld Once you have your app running on a real PlayBook tablet as discussed in [[3961]], you want to distribute it to BlackBerry's user base.
3961 Running Android Apps on the BlackBerry 10 Platform Your App works fine on real Android devices, and you're ready to move it to the next easy target: the BlackBerry Android Player.
3947 Introduction: "Other" Category N/A
3856 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.
3852 Adding Calendar Events You want to add an event to the user's on-device calendar.
3823 Using Existing/Standard Drawables You want to use existing drawables where possible to give your app a look that is consistent with standard Android.
3769 Using SuperUser on Rooted Devices You need root access to do something (non-nefarious) on the user's behalf, and you're running on a 'rooted' device.
3759 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.
3734 Introduction: GUI Alerts N/A
3683 Displaying Text Fields with TextView and EditText You want to display text on the screen, either read-only or editable.
3512 Freehand Drawing Smooth Curves You want to allow the user to draw smooth curves, such as freehand bezier curves, legal signatures, etc.
2874 Finding and Translating Strings You need to find all the strings in your application, internationalize them, and begin the process of translating them.
3427 Getting the source code of Android itself How did they do that?
3411 Providing User Preference Activity with Minimal Effort You want to let the user specify one or more preferences values, and have them persisted across runs of the program.
3369 Testing on a Huge Range of Devices with Cloud-based Testing You need to test your app on a wide variety of devices.
3255 Handling Long-Press/Long-Click Events You want to listen for long press / long click events and react to them, without having manually to check for multiple events.
3220 Getting File and Directory Information You need to know all you can about a given file "on disk", typically on internal memory or on the SD Card.
3200 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.
3185 Introduction: Location-Aware Applications N/A
3159 Introduction: Bluetooth N/A
502 Introduction: Packaging, Deploying, and Distributing N/A
3156 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.
3151 Introduction: Multimedia N/A
3137 Introduction: Telephone Applications N/A
3115 Reading Contact Data Using a Content Provider You need to extract details, such as a phone number or email address, from the Contacts database.
3112 Storing and Retrieving Data via a Content Provider You want to read from a Content Provider such as Contracts.
3100 Offering a Drop-Down Chooser via the Spinner Class You want to offer a drop-down choice item.
3095 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.
2111 Obfuscating and Optimizing with ProGuard You want to obfuscate your code, or optimize it (for speed or size), or all of the above.
2077 Rebooting the Device For some strange reason, you want the user's Android device to reboot.
2056 Introduction: Sensors N/A
2043 Designing a Conference/Camp/Hackathon/Institution App You want to design an app for use at a Conference, BarCamp, or Hackathon.
1946 Introduction: Graphics N/A
1944 Introduction: Testing N/A
1939 Introduction N/A
1882 Introduction: ListView N/A
1816 Introduction: Gaming and Animation N/A
1761 Making Lists Behave Nicely Lists are easy to get started with, but there are a lot of variations that will provide optimal user experience.
1651 Opening a Web Page, Phone Number, or Anything Else with an Intent The <tt>Intent</tt> 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.
1632 Making the Device Speak with Text-to-Speech You want your application to pronounce words of text so the user can perceive them without watching the screens (e.g., when driving).
1628 Playing Audio Without Interaction You want to play an audio file with no interaction.
1438 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"
1397 Creating a Button and Its Click Event Listener You need to do something when the user presses a Button.
1198 Dialing the Phone You want to dial the phone from within an application, without worrying about details of telephony.
1141 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.
1088 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.
1034 Getting 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.
102 Introduction: Social Networking N/A
104 Introduction: System and Device Control N/A
100 Introduction: Data Persistence N/A
3224 Easy Apps with App Inventor (placeholder recipe) You want to generate Android applications without needing to write either Java code or HTML.
844 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.
795 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.
709 Understanding the Android Activity Life Cycle Android apps do not have a "main" method; you need to learn how they get started and how they stop or get stopped.
682 Sharing Java Classes from Another Eclipse Project You want to use a class from another project, but don't want to copy-and-paste
671 Making a View Shake You want a View component to shake for a few seconds to catch the user's attention.
1036 Introduction: Other Programming Languages N/A
389 Formatting with Correct Plurals You're displaying something like <tt>"Found "+ n + " items"</tt>, but in English, "Found 1 reviews" is ungrammatical. You want "Found 1 review" for the case n == 1.
380 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.
1054 Introduction: GUI N/A
366 Listing a Directory You need to list the filesystem entries named in a directory.
358 Internationalizing Application Text You want the text of your buttons, labels and so on to appear in the user's chosen language.
352 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.
350 Introduction: Internationalization N/A
334 Adding a Contact through the Contacts Content provider You have some contact information that you want to save for use in the Contacts application.
323 Getting Location Information You want to know where you are.
306 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.
281 Getting Screenshots You need a standard way of getting screenshots for use in the Android Cookbook or any other documentation.
278 Creating a "Hello, World" Application using Eclipse You want to use Eclipse to develop your Android application.
272 Formatting Numbers You need to format numbers, because the default formatting of <tt>Double.toString()</tt> and friends do not give you enough control over how the results are displayed.
6 About O'Reilly Cookbooks What is special about the O'Reilly Cookbook Series?
236 Creating a "Hello, World" Application from the Command Line You want to create a new Android project without using the Eclipse ADT plug-in.
5 AsciiDoc 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.
137 Recommended Android Web Sites N/A
4 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.
73 Introduction: Inter-/Intra-Process Communication N/A
2 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.
10 Understanding and Following User Interface Guidelines Lots of developers, even good ones, are very bad at user interface design.
80 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.
75 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.
79 Consuming a RESTful Web Service using URLConnection You need to access a RESTful Web Service.
76 Introduction: Networking N/A
77 Running Native C/C++ 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
1 Preface N/A