1. Trang chủ
  2. » Công Nghệ Thông Tin

Pro Android 4 pot

1K 3.2K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Cover

    • Contents at a Glance

    • Contents

    • About the Authors

    • About the Technical Reviewers

    • Acknowledgments

    • Preface

  • Introducing the Android Computing Platform

    • A New Platform for a New Personal Computer

    • Early History of Android

    • Delving Into the Dalvik VM

    • Understanding the Android Software Stack

    • Developing an End-User Application with the Android SDK

      • Android Emulator

      • The Android UI

      • The Android Foundational Components

      • Advanced UI Concepts

      • Android Service Components

      • Android Media and Telephony Components

      • Android Java Packages

    • Taking Advantage of Android Source Code

      • Browsing Android Sources Online

      • Using Git to Download Android Sources

    • The Sample Projects in this Book

    • Summary

  • Setting Up Your Development Environment

    • Setting Up Your Environment

      • Downloading JDK 6

      • Downloading Eclipse 3.6

      • Downloading the Android SDK

      • The Tools Window

      • Installing Android Development Tools (ADT)

    • Learning the Fundamental Components

      • View

      • Activity

      • Fragment

      • Intent

      • Content Provider

      • Service

      • AndroidManifest.xml

      • Android Virtual Devices

    • Hello World!

    • Android Virtual Devices

    • Running on a Real Device

    • Exploring the Structure of an Android Application

    • Examining the Application Life Cycle

    • Simple Debugging

      • Launching the Emulator

    • References

    • Summary

    • Interview Questions

  • Understanding Android Resources

    • Understanding Resources

      • String Resources

      • Layout Resources

      • Resource Reference Syntax

      • Defining Your Own Resource IDs for Later Use

      • Compiled and Uncompiled Android Resources

    • Enumerating Key Android Resources

    • Working with Arbitrary XML Resource Files

    • Working with Raw Resources

    • Working with Assets

    • Reviewing the Resources Directory Structure

    • Resources and Configuration Changes

    • Reference URLs

    • Summary

    • Interview Questions

  • Understanding Content Providers

    • Exploring Android’s Built-in Providers

      • Exploring Databases on the Emulator and Available Devices

      • Quick SQLite Primer

    • Architecture of Content Providers

      • Structure of Android Content URIs

      • Structure of Android MIME Types

      • Reading Data Using URIs

      • Using the Android Cursor

      • Working with the where Clause

      • Inserting Records

      • Adding a File to a Content Provider

      • Updates and Deletes

    • Implementing Content Providers

      • Planning a Database

      • Extending ContentProvider

      • Fulfilling MIME-Type Contracts

      • Implementing the Query Method

      • Implementing an Insert Method

      • Implementing an Update Method

      • Implementing a Delete Method

      • Using UriMatcher to Figure Out the URIs

      • Using Projection Maps

      • Registering the Provider

    • Exercising the Book Provider

      • Adding a Book

      • Removing a Book

      • Getting a Count of the Books

      • Displaying the List of Books

    • Resources

    • Summary

    • Interview Questions

  • Understanding Intents

    • Basics of Android Intents

    • Available Intents in Android

    • Exploring Intent Composition

      • Intents and Data URIs

      • Generic Actions

      • Using Extra Information

      • Using Components to Directly Invoke an Activity

      • Understanding Intent Categories

      • Rules for Resolving Intents to Their Components

    • Exercising the ACTION_PICK

    • Exercising the GET_CONTENT Action

    • Introducing Pending Intents

    • Resources

    • Summary

    • Interview Questions

  • Building User Interfaces and Using Controls

    • UI Development in Android

      • Building a UI Completely in Code

      • Building a UI Completely in XML

      • Building a UI in XML with Code

    • Understanding Android’s Common Controls

      • Text Controls

      • Button Controls

      • The ImageView Control

      • Date and Time Controls

      • The MapView Control

    • Understanding Adapters

      • Getting to Know SimpleCursorAdapter

      • Getting to Know ArrayAdapter

    • Using Adapters with AdapterViews

      • The Basic List Control: ListView

      • The GridView Control

      • The Spinner Control

      • The Gallery Control

      • Creating Custom Adapters

      • Other Controls in Android

    • Styles and Themes

      • Using Styles

      • Using Themes

    • Understanding Layout Managers

      • The LinearLayout Layout Manager

      • The TableLayout Layout Manager

      • The RelativeLayout Layout Manager

      • The FrameLayout Layout Manager

      • The GridLayout Layout Manager

      • Customizing the Layout for Various Device Configurations

    • References

    • Summary

    • Interview Questions

  • Working with Menus

    • Understanding Android Menus

      • Creating a Menu

      • Working with Menu Groups

      • Responding to Menu Items

    • Working with Other Menu Types

      • Expanded Menus

      • Working with Icon Menus

      • Working with Submenus

      • Working with Context Menus

      • Working with Alternative Menus

      • Dynamic Menus

    • Loading Menus Through XML Files

      • Structure of an XML Menu Resource File

      • Inflating XML Menu Resource Files

      • Responding to XML-Based Menu Items

      • Pop-up Menus in 4.0

      • A Brief Introduction to Additional XML Menu Tags

    • Resources

    • Summary

    • Interview Questions

  • Fragments for Tablets and More

    • What Is a Fragment?

      • When to Use Fragments

      • The Structure of a Fragment

      • A Fragment’s Lifecycle

      • Sample Fragment App Showing the Lifecycle

    • FragmentTransactions and the Fragment Back Stack

      • Fragment Transaction Transitions and Animations

    • The FragmentManager

      • Caution When Referencing Fragments

      • Saving Fragment State

      • ListFragments and <fragment>

      • Invoking a Separate Activity When Needed

      • Persistence of Fragments

    • Communications with Fragments

      • Using startActivity() and setTargetFragment()

    • Custom Animations with ObjectAnimator

    • References

    • Summary

    • Interview Questions

  • Working with Dialogs

    • Using Dialogs in Android

    • Understanding Dialog Fragments

      • DialogFragment Basics

      • DialogFragment Sample Application

    • Working with Toast

    • Dialog Fragments for Older Android

    • References

    • Summary

    • Interview Questions

  • Exploring ActionBar

    • Anatomy of an ActionBar

    • Tabbed Navigation Action Bar Activity

      • Implementing Base Activity Classes

      • Assigning Uniform Behavior for the Action Bar

      • Implementing the Tabbed Listener

      • Implementing the Tabbed Action Bar Activity

      • Scrollable Debug Text View Layout

      • Action Bar and Menu Interaction

      • Android Manifest File

      • Examining the Tabbed Action Bar Activity

    • List Navigation Action Bar Activity

      • Creating a Spinner Adapter

      • Creating a List Listener

      • Setting Up a List Action Bar

      • Making Changes to BaseActionBarActivity

      • Making Changes to AndroidManifest.xml

      • Examining the List Action Bar Activity

    • Standard Navigation Action Bar Activity

      • Setting up the Standard Navigation Action Bar Activity

      • Making Changes to BaseActionBarActivity

      • Making Changes to AndroidManifest.xml

      • Examining the Standard Action Bar activity

    • Action Bar and Search View

      • Defining a Search View Widget as a Menu Item

      • Casting a Search Results Activity

      • Customizing Search Through a Searchable XML File

      • Defining the Search Results Activity in the Manifest File

      • Identifying the Search Target for the Search View Widget

    • The Action Bar and Fragments

    • References

    • Summary

    • Interview Questions

  • Advanced Debugging and Analysis

    • Enabling Advanced Debugging

    • The Debug Perspective

    • The DDMS Perspective

    • The Hierarchy View Perspective

      • Pixel Perfect View

    • Traceview

    • The adb Command

    • The Emulator Console

    • StrictMode

      • StrictMode Policies

      • Turning Off StrictMode

      • StrictMode with Old Android Versions

      • StrictMode Exercise

    • References

    • Summary

    • Interview Questions

  • Responding to Configuration Changes

    • The Configuration Change Process

      • The Destroy/Create Cycle of Activities

      • The Destroy/Create Cycle of Fragments

      • Using FragmentManager to Save Fragment State

      • Using setRetainInstance on a Fragment

    • Deprecated Configuration Change Methods

    • References

    • Summary

    • Interview Questions

  • Working with Preferences and Saving State

    • Exploring the Preferences Framework

      • Understanding ListPreference

      • Understanding CheckBoxPreference

      • Understanding EditTextPreference

      • Understanding RingtonePreference and MultiSelectListPreference

    • Organizing Preferences

      • Using PreferenceCategory

      • Creating Child Preferences with Dependency

      • Preferences with Headers

    • Manipulating Preferences Programmatically

      • Saving State with Preferences

      • Using DialogPreference

    • Reference

    • Summary

    • Interview Questions

  • Exploring Security and Permissions

    • Understanding the Android Security Model

      • Overview of Security Concepts

      • Signing Applications for Deployment

    • Performing Runtime Security Checks

      • Understanding Security at the Process Boundary

      • Declaring and Using Permissions

      • Understanding and Using Custom Permissions

      • Understanding and Using URI Permissions

    • References

    • Summary

    • Interview Questions

  • Building and Consuming Services

    • Consuming HTTP Services

      • Using the HttpClient for HTTP GET Requests

      • Using the HttpClient for HTTP POST Requests (a Multipart Example)

      • SOAP, JSON, and XML Parsers

      • Dealing with Exceptions

      • Addressing Multithreading Issues

      • Fun with Timeouts

      • Using the HttpURLConnection

      • Using the AndroidHttpClient

      • Using Background Threads (AsyncTask)

      • Getting Files Using DownloadManager

    • Using Android Services

      • Understanding Services in Android

      • Understanding Local Services

      • Understanding AIDL Services

      • Defining a Service Interface in AIDL

      • Implementing an AIDL Interface

      • Calling the Service from a Client Application

      • Passing Complex Types to Services

    • References

    • Summary

    • Interview Questions

  • Exploring Packages

    • Packages and Processes

      • Details of a Package Specification

      • Translating the Package Name to a Process Name

      • Listing Installed Packages

      • Deleting a Package Through the Package Browser

    • Revisiting the Package Signing Process

      • Understanding Digital Signatures: Scenario 1

      • Understanding Digital Signatures: Scenario 2

      • A Pattern for Understanding Digital Signatures

      • So How Do You Digitally Sign?

      • Implications of the Signing Process

    • Sharing Data Among Packages

      • The Nature of Shared User IDs

      • A Code Pattern for Sharing Data

    • Library Projects

      • What Is a Library Project?

      • Library Project Predicates

      • Creating a Library Project

      • Creating an Android Project That Uses a Library

      • Caveats to Using Library Projects

    • References

    • Summary

    • Interview Questions

  • Exploring Handlers

    • Android Components and Threading

      • Activities Run on the Main Thread

      • Broadcast Receivers Run on the Main Thread

      • Services Run on the Main Thread

      • Content Provider Runs on the Main Thread

      • Implications of a Singular Main Thread

      • Thread Pools, Content Providers, and External Service Components

      • Thread Utilities: Discovering Your Threads

    • Handlers

      • Implications of Holding the Main Thread

      • Using a Handler to Defer Work on the Main Thread

      • Sample Handler Source Code That Defers Work

      • Constructing a Suitable Message Object

      • Sending Message Objects to the Queue

      • Responding to the handleMessage Callback

    • Using Worker Threads

      • Invoking a Worker Thread from a Menu

      • Communicating Between the Worker and the Main Threads

    • Component and Process Lifetimes

      • Activity Life Cycle

      • Service Life Cycle

      • Receiver Life Cycle

      • Provider Life Cycle

    • References

    • Summary

    • Interview Questions

  • Exploring the AsyncTask

    • Implementing a simple AsyncTask

      • GettingPpast the Generics in AsyncTask

      • Subclassing an Async Task

      • Implementing Your First Async Task

      • Calling an Async Task

      • onPreExecute() Callback and Progress Dialog

      • doInBackground() method

      • Triggering onProgressUpdate()

      • onPostExecute() Method

      • Upgrading to the Deterministic Progress Dialog

    • Nature of an Async Task

    • Device Rotation and AsyncTask

    • Life Cycle Methods and AsyncTask

    • References

    • Summary

    • Interview Questions

  • Broadcast Receivers and Long-Running Services

    • Broadcast Receivers

      • Sending a Broadcast

      • Coding a Simple Receiver: Sample Code

      • Registering a Receiver in the Manifest File

      • Accommodating Multiple Receivers

      • Out-of-Process Receivers

    • Using Notifications from a Receiver

      • Monitoring Notifications Through the Notification Manager

      • Sending a Notification

      • Starting an Activity in a Broadcast Receiver

    • Long-Running Receivers and Services

      • Long-Running Broadcast Receiver Protocol

      • IntentService

      • IntentService Source Code

    • Extending IntentService for a Broadcast Receiver

      • Long-Running Broadcast Service Abstraction

      • A Long-Running Receiver

      • Abstracting a Wake Lock with LightedGreenRoom

    • Long-Running Service Implementation

      • Details of a Nonsticky Service

      • Details of a Sticky Service

      • A Variation of Nonsticky: Redeliver Intents

      • Specifying Service Flags in OnStartCommand

      • Picking Suitable Stickiness

      • Controlling the Wake Lock from Two Places

      • Long-Running Service Implementation

      • Testing Long-Running Services

      • Your Responsibilities

      • Framework Responsiblities

    • A Few Notes about the Project Download File

    • References

    • Summary

    • Interview Questions

  • Exploring the Alarm Manager

    • Alarm Manager Basics: Setting Up a Simple Alarm

      • Getting Access to the Alarm Manager

      • Setting Up the Time for the Alarm

      • Creating a Receiver for the Alarm

      • Creating a PendingIntent Suitable for an Alarm

      • Setting the Alarm

      • Test Project

    • Exploring Alarm Manager Alternate Scenarios

      • Setting Off an Alarm Repeatedly

      • Cancelling an Alarm

      • Working with Multiple Alarms

      • Intent Primacy in Setting Off Alarms

      • Persistence of Alarms

    • Alarm Manager Predicates

    • References

    • Summary

    • Interview Questions

  • Exploring 2D Animation

    • Frame-by-Frame Animation

      • Planning for Frame-by-Frame Animation

      • Creating the Activity

      • Adding Animation to the Activity

    • Layout Animation

      • Basic Tweening Animation Types

      • Planning the Layout Animation Test Harness

      • Creating the Activity and the ListView

      • Animating the ListView

      • Using Interpolators

    • View Animation

      • Understanding View Animation

      • Adding Animation

      • Using Camera to Provide Depth Perception in 2D

      • Exploring the AnimationListener Class

      • Notes on Transformation Matrices

    • Property Animations: The New Animation API

      • Property Animation

      • Planning a Test Bed for Property Animation

      • Basic View Animation with Object Animators

      • Sequential Animation with AnimatorSet

      • Setting Animation Relationships with AnimationSetBuilder

      • Using XML to Load Animators

      • Using PropertyValuesHolder

      • View Properties Animation

      • Type Evaluators

      • Key Frames

      • Layout Transitions

    • Resources

    • Summary

    • Interview Questions

  • Exploring Maps and Location-based Services

    • Understanding the Mapping Package

      • Obtaining a Maps API Key from Google

      • Understanding MapView and MapActivity

      • Adding Markers Using Overlays

    • Understanding the Location Package

      • Geocoding with Android

      • Geocoding with Background Threads

      • Understanding the LocationManager Service

      • Showing Your Location Using MyLocationOverlay

      • Using Proximity Alerts

    • References

    • Summary

    • Interview Questions

  • Using the Telephony APIs

    • Working with SMS

      • Sending SMS Messages

      • Monitoring Incoming SMS Messages

      • Working with SMS Folders

      • Sending E-mail

    • Working with the Telephony Manager

    • Session Initiation Protocol (SIP)

      • Experimenting with SipDemo

      • The android.net.sip package

    • References

    • Summary

    • Interview Questions

  • Understanding the Media Frameworks

    • Using the Media APIs

      • Using SD Cards

    • Playing Media

      • Playing Audio Content

      • Playing Video Content

    • Recording Media

      • Exploring Audio Recording with MediaRecorder

      • Recording Audio with AudioRecord

      • Exploring Video Recording

      • Exploring the MediaStore Class

      • Recording Audio Using an Intent

      • Adding Media Content to the Media Store

      • Triggering MediaScanner for the Entire SD Card

      • References

    • Summary

    • Interview Questions

  • Home Screen Widgets

    • Architecture of Home Screen Widgets

      • What Are Home Screen Widgets?

      • User Experience with Home Screen Widgets

      • Life Cycle of a Widget

    • A Sample Widget Application

      • Defining the Widget Provider

      • Defining Widget Size

      • Widget Layout-Related Files

      • Implementing a Widget Provider

      • Implementing Widget Models

      • Implementing Widget Configuration Activity

    • Widget Preview Tool

    • Widget Limitations and Extensions

    • Collection-Based Widgets

    • Resources

    • Summary

    • Interview Questions

  • Exploring List Widgets

    • A Quick Note on Remote Views

    • Working with Lists in Remote Views

      • Preparing a Remote Layout

      • Loading a Remote Layout

      • Setting Up RemoteViewsService

      • Setting Up RemoteViewsFactory

      • Setting Up onClick Events

      • Responding to onClick Events

    • Working Sample: Test Home Screen List Widget

      • Creating the Test Widget Provider

      • Creating the Remote Views Factory

      • Coding Remote Views Service

      • Main Widget Layout File

      • Widget Provider Metadata

      • AndroidManifest.xml

    • Testing the Test List Widget

    • References

    • Summary

    • Interview Questions

  • Touch Screens

    • Understanding MotionEvents

      • The MotionEvent Object

      • Recycling MotionEvents

      • Using VelocityTracker

    • Multitouch

      • The Basics of Multitouch

    • Touches with Maps

    • Gestures

      • The Pinch Gesture

      • GestureDetector and OnGestureListeners

      • Custom Gestures

      • The Gestures Builder Application

    • References

    • Summary

    • Interview Questions

  • Implementing Drag and Drop

    • Exploring Drag and Drop

    • Basics of Drag and Drop in 3.0+

    • Drag-and-Drop Example Application

      • List of Files

      • Laying Out the Example Drag-and-drop Application

      • Responding to onDrag in the Dropzone

      • Setting Up the Drag Source Views

    • Testing the Example Drag-and-Drop Application

    • References

    • Summary

    • Interview Questions

  • Using Sensors

    • What Is a Sensor?

      • Detecting Sensors

      • What Can We Know About a Sensor?

    • Getting Sensor Events

      • Issues with Getting Sensor Data

    • Interpreting Sensor Data

      • Light Sensors

      • Proximity Sensors

      • Temperature Sensors

      • Pressure Sensors

      • Gyroscope Sensors

      • Accelerometers

      • Magnetic Field Sensors

      • Using Accelerometers and Magnetic Field Sensors Together

      • Orientation Sensors

      • Magnetic Declination and GeomagneticField

      • Gravity Sensors

      • Linear Acceleration Sensors

      • Rotation Vector Sensors

      • Near Field Communication Sensors

    • References

    • Summary

    • Interview Questions

  • Exploring the Contacts API

    • Understanding Accounts

      • A Quick Tour of Account Screens

      • Relevance of Accounts to Contacts

      • Enumerating Accounts

    • Understanding the Contacts Application

      • Introducing the Personal Profile

      • Showing Contacts

      • Showing Contact Details

      • Editing Contact Details

      • Setting a Contact’s Photo

      • Exporting Contacts

      • Various Contact Data Types

    • Understanding Contacts

      • Examining the Contacts SQLite Database

      • Raw Contacts

      • Data Table

      • Aggregated Contacts

      • view_contacts

      • contact_entities_view

    • Working with the Contacts API

      • Exploring Accounts

      • Exploring Aggregated Contacts

      • Exploring Raw Contacts

      • Exploring Raw Contact Data

      • Adding a Contact and Its Details

    • Controlling Aggregation

    • Impacts of Syncing

    • Understanding the Personal Profile

      • Reading Profile Raw Contacts

      • Reading Profile Contact Data

      • Adding Data to the Personal Profile

    • References

    • Summary

    • Interview Questions

  • Deploying Your Application: Android Market and Beyond

    • Becoming a Publisher

      • Following the Rules

      • Developer Console

    • Preparing Your Application for Sale

      • Testing for Different Devices

      • Supporting Different Screen Sizes

      • Preparing AndroidManifest.xml for Uploading

      • Localizing Your Application

      • Preparing Your Application Icon

      • Considerations for Making Money from Apps

      • Directing Users Back to the Market

      • The Android Licensing Service

      • Using ProGuard for Optimizing, Fighting Piracy

      • Preparing Your .apk File for Uploading

    • Uploading Your Application

      • Graphics

      • Listing Details

      • Publishing Options

      • Contact Information

      • Consent

    • User Experience on Android Market

    • Beyond Android Market

    • References

    • Summary

    • Interview Questions

  • Index

    • Special Characters and Numerics perception

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

Nội dung

[...]... writing unit tests for Android applications CHAPTER 1: Introducing the Android Computing Platform android. text: Contains text-processing classes android. text.method: Provides classes for entering text input for a variety of controls android. text.style: Provides a number of styling mechanisms for a span of text android. utils: Contains the classes Log, DebugUtils, TimeUtils, and Xml android. view: Contains... in Android is the content provider A content provider is an abstraction of a data source that makes it look like an emitter and consumer of RESTful services The underlying SQLite database makes this facility of content providers a powerful tool for application developers We will cover content providers in Chapter 4 In Chapters 3, 4, and 5, we’ll discuss how intents, resources, and content providers promote... Moreover, Android allows you to define these animations in an XML resource file Check out this example, in which a series of numbered images is played in frame-by-frame animation: …… The Android manifest file is where activities... package are covered in Chapter 24 android. media.audiofx: Provides audio effects android. media.effect: Provides video effects android. mtp: Provides the ability to interact with cameras and music devices android. net: Implements the basic socket-level network APIs Primary classes include Uri, ConnectivityManager, LocalSocket, and LocalServerSocket It is also worth noting here that Android supports HTTPS at... Application with the Android SDK In this section, we’ll introduce you to the high-level Android Java APIs that you’ll use to develop end-user applications on Android We will briefly talk about the Android emulator, Android foundational components, UI programming, services, media, telephony, animation, and more Android Emulator The Android SDK ships with an Eclipse plug-in called Android Development... www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java /android/ However, there are rumors that the Code Search project may be in the process of getting shut down Even if it is not, this site does not search the Android 4. 0 code yet For example, we were not able to find the new Contact APIs here Another useful site is www.grepcode.com/search/?query=google +android& entity=project There seems to be a 4. 01 branch of Android available here... “References” section that contains a URL to download sample projects for that chapter All of these sample projects can be accessed from http://androidbook.com/proandroid4/projects If you have any issues downloading or compiling these projects, please contact us by email: satya.komatineni@gmail.com or davemac327@gmail.com We are continuously updating the androidbook.com supporting site with what we are learning... least, Android ties all these concepts into an application by creating a single XML file that defines what an application package is This file is called the application’s manifest file (AndroidManifest.xml) Here is an example: ... setting up the Android development environment The Android Foundational Components The Android UI framework, along with many other parts of Android, relies on a new concept called an intent An intent is an intra- and interprocess mechanism to invoke components in Android A component in Android is a piece of code that has a well defined life cycle An activity representing a window in an Android application . Java programming language, coupled with Android s extensive class library, makes Android a compelling platform to write programs for. Figure 1–1 provides. about the Android emulator, Android foundational components, UI programming, services, media, telephony, animation, and more. Android Emulator The Android

Ngày đăng: 15/03/2014, 22:20

Xem thêm

TỪ KHÓA LIÊN QUAN