This repo is among the largest collections of Android code samples anywhere; it containsaround a hundred and fifty compilable source code examples fromthe O’Reilly Android Cookbook, a great sourceof tutorial material for the Android Developer. Not all recipes in the book or online have codeaccompanying them; this repo features code that was either linked by thecontributor, or in some cases, re-constructed as a New Project by theeditor for your convenience.
Further note that not all programs used in the book/online appear here; someof the examples in the book/online are only program fragments taken fromother programs that can’t be included. And of course some code is drawn from existing projectsthat are hosted elsewhere.
Each Directory comprises its own project, and has a name that is cited at the end of the corresponding Recipe, under the "Source Code Download" section.
Some older started-in-Eclipse projects also have configuration files to allow them to be opened in Android Studio.During the runup to the second edition of the book, AndMore appeared to be a viable projectto maintain Android Eclipse development.However, over time, it has become clear that AndMore has not attracted enough developer talentto remain viable.Accordingly, the newest projects here are Android-Studio-Only.And Issue #1 calls for moving the existing mass of projects to Studio-only format.For reference, a "canonical" project would look something like this:
README.txt app/ ├── app.iml ├── build/ ├── build.gradle ├── libs ├── proguard-rules.pro └── src ├── androidTest │ └── java │ └── com │ └── darwinsys │ └── circleviewgroup │ └── ExampleInstrumentedTest.java ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ └── androidcookbook │ │ └── some_project_name │ │ └── MainActivity.java │ └── res │ ├── drawable │ ├── layout │ │ └── activity_main.xml │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ ├── mipmap-* │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml └── test └── java └── com └── darwinsys └── circleviewgroup └── ExampleUnitTest.java build.gradle gradlew, gradlew.bat local.properties settings.gradle
The table List of Projects shows lists each project, its author, and a short summary.
*Note that, since Gradle and the Gradle Android Plugin need to be updatedjust about every time your run Android Studio, there is no attempt madeto keep things up-to-date here; just let Studio do its upgrade thing for youand all will be well. They promise.
JpsTrack and the ToDo applications have graduated to their own github projects, underhttps://github.com/IanDarwin.
The following list is generated (periodically) from the project folders.In the Builds With column, E for Eclipse, M for Maven, S for Android Studio, G for Gradle.The Author names have recently been added; if I have missed or mis-attributed any, pleaselet me know and I will happily correct them. You (and I) know who you are.
Project | Author | Function | Notes |
---|---|---|---|
Ian Darwin |
A re-usable About dialog. |
- |
|
Ian Darwin |
Info about device and screen |
- |
|
Ian Darwin |
Simple ActionBar demo(s) |
- |
|
Ian Darwin |
Add a contact |
Shows ContactsContract, content provider |
|
Ian Darwin |
Using AdMob with interstitial (inter-Activity) ads. |
- |
|
Ian Darwin |
Ashwini’s Google Analytics for Android Demo, slightly updated. |
- |
|
Rachee Singh |
Graphing |
- |
|
Wagied Davids |
RSS Reader |
Works under Maven; Eclipse fails w/ Maven Configuration Problem |
|
Ian Darwin |
Installs another app |
Downloading, package management |
|
Ian Darwin |
Shows App Shortcuts, which appear with long-press on app’s launcher icon. |
- |
|
Ian Darwin |
Compilable example of the Application Singleton pattern recipe. |
- |
|
Ian Darwin |
Contact picker with autocomplete |
- |
|
Ian Darwin |
App can update itself |
see AppDownloader |
|
Ian Darwin |
Use Android Backup scheme. |
- |
|
Ian Darwin |
Bluetooth Connection |
- |
|
Ian Darwin |
Add appointment to Calendar |
Calendar via Content Provider |
|
Ian Darwin |
Pretend a call happened, for testing |
- |
|
Johan Pelgrim |
Intercept an incoming phone call. |
- |
|
Johan Pelgrim |
Intercept outgoing phone calls. |
Compiles and runs, but doesn’t intercept the call. |
|
Ian Darwin |
CameraIntent - get the camera to take a picture, by startActivityForResult() |
- |
|
Ian Darwin |
Demonstation of Card widget. |
- |
|
Ian Darwin |
GUI demo |
name says it |
|
Ian Darwin |
Attempt at a custom layout manager. |
- |
|
Ian Darwin |
List of bookmarks from Bookmarks Content Provider |
Browser ContentProvider |
|
Ian Darwin |
List of ContentProviders |
- |
|
Ashwini Shahapurkar |
Implement a ContentProvider |
- |
|
Ian Darwin |
Test it |
- |
|
Ian Darwin |
Simple Cordova cross-platform (web-based) toolkit demo. |
- |
|
Wagied Davids |
Time-based activity |
- |
|
Ian Darwin |
Application Widgets have a live display on the home page, like the standard Clock program. |
- |
|
Ian Darwin |
How to load data properly using CursorLoader |
- |
|
Ian Darwin |
Menu |
- |
|
Ian Darwin |
Submenu, created programmatically |
- |
|
Rachee Singh |
Toast |
- |
|
Ian Darwin |
Create a database from an SQLite .db file in 'assets'. |
- |
|
Ian Darwin |
Fake up a Cursor from a list of files |
- |
|
Ian Darwin |
Example of various DateFormat usages (the Android one, not java.text nor java.time). |
- |
|
Ian Darwin |
Dialogs |
- |
|
Ian Darwin |
A simple Drag-and-drop example. |
- |
|
Ian Darwin |
Demo of "Dreams" (4.x screensaver) |
- |
|
Wagied Davids |
Send contents of EditText via email |
- |
|
Marco Dinacci |
Attach file to email |
- |
|
Wagied Davids |
Java + JavaScript Epoch Calendar |
- |
|
Daniel Fowler |
5 Ways to Wire an Event Listener. |
- |
|
N/R. Pending check. |
Access FB API |
- |
|
Wagied Davids |
Face locator API in photos |
- |
|
Ian Darwin |
Demo of FileProvider. |
- |
|
Ian Darwin |
Internal and external files. |
- |
|
Ian Darwin |
Find Me X |
IllegalArgumentException: Incomplete location object, missing timestamp or accuracy, Progress:334 |
|
Ian Darwin |
Demo of 'fab' Floating Abstract Button |
- |
|
Ian Darwin |
Using a custom font |
You need to provide the font file! Example uses Iceberg font… |
|
Ian Darwin |
Simple Fragment and List-Detail Fragments in one project |
- |
|
Ian Darwin |
Simple Photo Gallery example. |
Deprecated |
|
Ian Darwin |
Google Cloud Messaging - receiver |
- |
|
Ian Darwin |
Google Cloud Messaging - sender |
- |
|
Ian Darwin |
A program that shows the Storage Facility to prompt for all files. |
- |
|
Ian Darwin |
Haptic Feedback recipe. |
- |
|
Ian Darwin |
HelloWorld |
SDK |
|
Ian Darwin |
HelloWorld |
Eclipse ADT |
|
Ian Darwin |
HelloWorld of EspressoTesting |
- |
|
Ian Darwin |
Hello World with Gradle but NOT Studio. |
- |
|
Ian Darwin |
HelloWorld using Maven with android-maven-plugin. |
- |
|
Ian Darwin |
HelloWorld of StudioTesting |
- |
|
Adrián Santalla |
ADT Testing - subject |
- |
|
Ian Darwin |
ADT Testing - Tests |
- |
|
Ian Darwin |
A Home Application |
Shows running a program |
|
Ian Darwin |
List View with Icon |
- |
|
Ian Darwin |
ImageButtons! |
- |
|
Ian Darwin |
Intents |
- |
|
Ian Darwin |
IPC - Inter-Process Communication, simplified demo (2 versions, alas). |
- |
|
Rupesh Chavan |
IPC - Inter-Process Communication, simplified demo (2 versions, alas). |
- |
|
Ian Darwin |
Getting data from Java to JavaScript and back. |
- |
|
Ian Darwin |
Demos of java.time date/time API |
Actually JSR-310 API; almost same but different package |
|
Ian Darwin |
Simple example of JSON parsing using built-in JSONObject. |
- |
|
Ian Darwin |
Kotlin version of Volley demo |
- |
|
Ian Darwin |
Layout Border Demo Project Source for Android |
- |
|
Marco Dinacci |
ListView |
- |
|
Ian Darwin |
ListView |
- |
|
Rachee Singh |
ListView with empty list: don’t show blank screen! |
- |
|
Ian Darwin |
ListView with section headers |
- |
|
Ian Darwin |
Local Broadcast Receiver |
- |
|
Ian Darwin |
This is the Google API Maps V2 Demo. |
- |
|
Ian Darwin |
Adding a Google Maps V2 MapActivity to a project |
You must ask for permission from Google (get and provide your own Google API key). |
|
Ian Darwin |
Search the Play Store |
- |
|
Ian Darwin |
MaterialDesign demos |
- |
|
Ian Darwin |
Play media |
- |
|
Ian Darwin |
Media Player demo from Marco Dinacci, thanks. |
- |
|
Marco Dinacci |
Simple sound recorder |
- |
|
Ian Darwin |
Menu Action Handling |
- |
|
Ian Darwin |
Try to invoke native code from JavaScript. |
- |
|
Ian Darwin |
Native Development Kit |
C Code |
|
Ian Darwin |
Notifications |
- |
|
Ian Darwin |
UI for picking numbers |
- |
|
Ian Darwin |
Demo of OAuth2 to Google Tasks. |
- |
|
Marco Dinacci |
OpenGL graphics |
- |
|
Wagied Davids |
Rotation |
- |
|
Rachee Singh |
Basic OSM map app demo. |
Builds with Maven, not with Eclipse. Maybe m2e aar support, isn’t, yet. |
|
Ian Darwin |
OSM Map with a map marker overlay |
Compiles, runs, doesn’t load map tiles; needs upgrading to osmdroid-android 5.5 |
|
Ian Darwin |
OSM Map with touch event handling. |
Builds with Maven, not with Eclipse. Maybe m2e aar support, isn’t, yet. |
|
Ian Darwin |
Create and share a PDF |
- |
|
Ian Darwin |
Shows asking for permissions at runtime, i.e,. "the new way" |
- |
|
Shraddha Shravagi |
HTML5 app using phonegap/cordova |
- |
|
Ian Darwin |
Pinch-and-zoom graphics demo |
- |
|
Ian Darwin |
Preferences |
- |
|
Ian Darwin |
Demo of a pop-up indefinite progress dialog. |
- |
|
Ian Darwin |
Using a graphing library |
- |
|
Ian Darwin |
Show use of 5-star RatingBar as used in rankings, surveys, &c. |
- |
|
Ian Darwin |
How to reboot, and why you can’t |
- |
|
Ian Darwin |
= RecipeList - use an AsyncTask to download data over the 'net via HTTP. |
- |
|
Ian Darwin |
Demo of RecyclerView, the faster ListView. |
- |
|
Ian Darwin |
This folder is created automatically by Eclipse and can be ignored. |
- |
|
Wagied Davids |
Using a graphing library |
- |
|
Ian Darwin |
Demo of Room, the official Android ORM. |
- |
|
Ian Darwin |
A simpe runtime log facility |
- |
|
Ian Darwin |
Scan barcode using ZXing app via Intent |
- |
|
Ian Darwin |
Trivial example of one Activity (screen) starting another. |
- |
|
Colin Wilcox |
Sends an SMS |
- |
|
Thomas Manthey |
Use Accellerometer to detect if the user has shaken the device. |
- |
|
Rachee Singh |
Code for r2051, Checking Whether a Device Is Facing Up or Down |
- |
|
Ian Darwin |
ICS "Share" action |
- |
|
Ian Darwin |
Run a Unix/Linux command via Runtime.exec, capture the output. |
- |
|
Ian Darwin |
User account on device |
- |
|
Ian Darwin |
Calendar |
- |
|
Ian Darwin |
Trivial Dialer - launches Dialer app via Intent |
- |
|
Wagied Davids |
Common code for flixel-gdx-based gaming demo. |
Game starts, can move left-right only, no scenery. Fails on Intel phone/emulator |
|
Wagied Davids |
Start of a pool/billiards game using AndEngine. |
- |
|
Saketkumar Srivastav |
Simple Torchlight/Flashlight example. |
(Most devices now have a built-in control for this) |
|
Wagied Davids |
The main code is from the "Sliding Drawer - Top Down" recipe |
- |
|
Ian Darwin |
Receive an incoming SMS. |
- |
|
Ian Darwin |
Snackbar (bottom message text) demo |
- |
|
Ian Darwin |
XML SOAP Web Service |
- |
|
Jonathan Fuerth |
Change the Enter key to "Next" on one-line text fields. |
- |
|
Ian Darwin |
Sound Recorder |
- |
|
Ian Darwin |
Text To Speech (TTS) |
- |
|
Ian Darwin |
Speech Recognizer. |
- |
|
Ian Darwin |
Drop-down Spinner Demos |
- |
|
Marco Dinacci |
OpenGL Spinning Cube, from Marco Dinacci |
- |
|
Rachee Singh |
Splash screen |
- |
|
Ian Darwin |
SQLite demos |
- |
|
Ian Darwin |
Use Existing Drawables |
- |
|
Ian Darwin |
StaticFileRead - read a file from the application |
- |
|
Daniel Fowler |
Demos for "Nuances of Strings.xml" recipe. |
- |
|
Ian Darwin |
TabHost Demo: Demo of the TabHost widget, in a Dialog. |
- |
|
Ian Darwin |
Tabbable and swipeable layout |
- |
|
Ian Darwin |
Telephone call recorder (in progress!) |
- |
|
Pratik Rupwal |
Displays phone info |
- |
|
Sunit Katkar |
Full app: compute and show restaurant bill with tip |
- |
|
Ian Darwin |
Find device’s unique ID |
- |
|
Rachee Singh |
Make the device vibrate |
- |
|
Ian Darwin |
Swipe among views |
- |
|
Ian Darwin |
Demo of Volley networking library |
- |
|
Wagied Davids |
Apple-style Wheel Picker Demo |
- |
|
Ian Darwin |
Graphical window background |
- |
Build Cookbook The Android Build Cookbook offers code snippets to help you quickly implement some common build tasks. For additional instruction, please see the other build documents in this secti
http://source.android.com/porting/build_cookbook.html Android的Build Cookbook提供代码片段以帮助您快速执行一些常见的build任务。如需指示,请参阅本节中的其他build文件. Building a simple APK LOCAL_PATH := $(call my-dir) include $(CLEAR_V
android开发人员要求 by Ayusch Jain 通过Ayusch Jain 如果您想成为一名Android开发人员,请阅读这些书 (If you want to become an Android developer, read these books) I’ve been an Android developer for the last three years, and in tha
下载地址:网盘下载 内容简介 The world of Raspberry Pi is evolving quickly, with many new interface boards and software libraries becoming available all the time. In this cookbook, prolific hacker and author Simon
This cookbook contains recipes that demonstrate how to solve common problems while writing Flutter apps. Each recipe is self-contained and can be used as a reference to help you build up an applicatio
JAVA高级架构师技术栈 任何技能通过 “刻意练习” 都可以达到融会贯通的境界,就像烹饪一样,这里有一份JAVA开发技术手册,只需要增加自己练习的次数。 JAVA程序猿笔试面试干货分享 IDEA-2019-1永久激活教程 觉得不错,就 ★Star 吧 �� 刷题吧 �� �� 数据结构和算法 数据结构 �� 01-线性表 �� 02-链表 �� 03-栈、队列 �� 04-哈希 �� 05-树 �
本章包含了对于典型的运行时升级/降级案例的 .appup 文件的范例。 变更功能模块 当要对一个功能模块进行变更时,例如如果添加了一个新的函数或者更正了一个错误,使用简单代码替换就足够了。 例如: {"2", [{"1", [{load_module, m}]}], [{"1", [{load_module, m}]}] }. 变更驻留模块 在依据OTP设计原理实现的系统中,所有的进程,除了
ceph-cookbook 包含一份电子书用于 Ceph 的安装配置和管理
R Markdown Cookbook This repository contains the source files of the book R Markdown Cookbook, to be published in October 2020 by Chapman & Hall/CRC. You may also read the free online version at https
CMake Cookbook This repository collects sources for the recipes contained in theCMake Cookbookpublished by Packt and authored by Radovan Bast andRoberto Di Remigio Contributing Testing Table of conten