Android2EE

  • Adapté
  • Large
  • Etroit
  • Increase font size
  • Default font size
  • Decrease font size
Prochaines formations Android inter-entreprises par Android2EE

Inscrivez-vous.

Inscrivez-vous dès maintenant.
N'attendez pas que les formations soient remplies (8 places maximum).

par mail : contact@android2ee.com ou

par téléphone 06 50 48 24 93. 
Du 24 au 28 Juin
Du 23 au 27 Sept.
Du 18 au 22 Nov. 
Paris  Formation Init.: Des fondamentaux à l'autonomie et la performance (3j)
Formation complète: Fondamentaux, Architecture et Android 4 (5j) 
Du 07 au 11 Oct.  Lyon Formation Init.: Des fondamentaux à l'autonomie et la performance (3j)
Formation complète : Fondamentaux, Architecture et Android 4 (5j) 
Du 16 au 20 Sept.
Du 25 au 29 Nov.
 

Toulouse
Formation Init.: Des fondamentaux à l'autonomie et la performance (3j)
Formation complète : Fondamentaux, Architecture et Android 4 (5j) 
La conférence "Android a Quick Course" est disponible, n'hésitez pas à la visionner. ici

Participez aux formations Android2EE et gagnez peut-être le Nexus (plus d'informations)

Lancement dès Octobre 2013 de la fromation Android 4+ dédiée à HoneyComb, IceCreamSandwich et JellyBean. Stay Tuned

Android, A Quick Course

E-mail Print PDF
Now available for only 6.5€ in its english version.

couv-quick-course

Android, A Quick Course

Author : Mathias Seguy
Co-Author (Graphist): Yannick Bergès
Co-Author (Translator):Thomas Hatcher

Pages number : 201 pages
Publication Date: 15/06/2011

Published by http://android2ee.com

Original Title: Android, A Quick Course.

ISBN : 979-10-90388-04-8

Copyright © 2011 by Mathias Séguy

EBook's goals

Google's new operating system for mobile devices and tablets is here! The software already has a solid reputation and is invading the world of mobile communications, it is open-source and offers programmers Java development tools. It makes mobile development accessible to all objets objects developers with only a small investment needed to improve their skills. The only question is : Are you ready for it?

The goal of this book is simply to allow you to become an autonomous Android programmer in record timing. If you are already a Java programmer (either beginner or advanced), the goal is for you to reach this autonomy in less than 10 days. This goal was what originally fueled the creation of this book : the necessity to offer my company's collaborators an effective and fast way to improve their skills. After reading this book you will be able to conceive an application, implement it, test it and internationalise it before finally delivering it to your client.

This book therefore focuses on two main aspects :

  • le savoir faire : How to Do
  • le savoir concevoir : How to think about it

The “savoir faire” knowledge is illustrated in the examples of Android code that are :

  • presented as “barebones”, without any functional consideration
  • extremely precise and specific (ie a project for a combo-box, one for a web kit etc) that are there only to explain a certain concept in relation to a particular example commented and clarifeid

A short paragraph describes and explains the key ideas required to understand the code and then the code finishes the demonstration by illustrating the concept. This “savoir faire” will allow you to access the different problems raised by a given concept. On certain specific subjects that are particularly complex and that would require a much more detailed treatment, for the sake of fluidity, we will simply give introductory aspects that will allow you to pursue the question in your own time.

Concerning the “savoir concevoir”, this book explains the key points of how an Android application is structured. It presents the various elements that make up the main architecture of the system and explicits how to build an application based on these principles and how to exploit it in the most effective way. Each one of the concepts is explained by a particular Android project containing examples of code. The reader is encouraged to start by quickly reading the whole book without dwelling to much on each concept so that they might rapidly get an overview of how Android programming works. Then, the reader may refer to specific chapters of interest that he wishes to put to use. Once the reader has assessed the main considerations of any Android application, he may then acquire the “savoir faire” based on precise examples and use the provided code to build his own projects. Once all the skills have been acquired, this book will remain as a valuable source of information from which he might extract both ready-made code examples and explanations of the keys concepts associated with their use.

Content

This is broken down into four distinct parts.

The first part is aimed at developers and allows them to quickly make create applications containing graphical elements. This part describes and explains how to use components and how to structure an application. It therefore contains a description of the usual objects, keyboard management, menu management, of how to manipulates fonts and characters, of the WebKit browser, pops up messages... This section of the book provides the information to make what most developers want and need : IHMs.

The second part, that is more specifically aimed at developers/ designers/ architects explains how to:

  • Manage the processing associated to the activities (and the creation of threads).
  • Manage an activity's life cycle.
  • Use Android's event system with Intents.
  • Manage resources (image files, text, colors, themes)
  • Define and exploit a data base
  • Use and define a ContentReceiver and it's counterpart the ContentProvider
  • Use and define a Service.
This second section deals with questions linked to developing the context of a company. It focuses on how to structure an Android application and how to respect the constraints of such a project.

The third part concentrates on how to :

  • Communicate with the internet.
  • Use http protocol to pass objects between a server of servlets and your application.
  • Use other services and hence asking permission to do so.
  • Use geo-localization and geo-coding
  • Manage SMS and make phone calls
  • Use multimedia files
  • Use and manage Bluetooth, networks and wifi.
  • Communicate with device's sensors
This last point mainly looks at how to communicate with the system. It principally addresses developers/designers/architects who need to exploit the platform's already existing services.

And the last part explains the first step on Android application life's cycle: How to set the Android development environment.


Who is this book for ?

This book is written for several types of reader and will provide them with information that will allow them to reach their goals. What these readers all have in common is their desire to create Android based programs either for professional or amateur uses, as developers or as architects.

First of all, the amateur developer will be pleased to be able to quickly get their applications up and running thanks to the examples and simple explanations. The first part of the book explains how to set up “the screens” GUI (Graphical User Interfaces) for Android. Most amateur developers will want to focus on acquire an in depth knowledge of this aspect to become an efficient graphic programmer. Using the provided code examples, they will then be able to graft onto their GUI specific components and effortlessly improve their applications. The various components are :
  • the Internet
  • Using the HTTP bus
  • Using MapView
  • Using GeoCoder
  • Making telephone calls
  • Sending and receiving SMS
  • Reading Audio files
  • Reading/recording Video, taking a Photo
  • Using Bluetooth
  • Managing Network connections (GPRS, 3G, wifi)
  • Communicating with sensors : accelerometer, compas, magnetic field, temperature...
The second type of reader that this book is aimed at is the objects developer working in a company who needs to quickly get to grips with all the different structural aspects of an Android application, build GUI and services, exploit and implement data bases, create http communication buses, manage resources and their internationalization... He will be able to have a lucid and concise overview of the whole system and rapidly create each of the required components whilst respecting both Android's coding rules and it's philosophy. This book provides solutions to the main preoccupations that arise in “company aimed applications”
  • Keyboard management
  • Font and character management
  • Thread management
  • Cycle of life events management
  • Intents and Intents filter management
  • Permissions management
  • Ressource management
    • Ressource files (internationalization and device trees), styles, themes,...
    • Internal and external files
    • Preferences
  • SQLite data-base management
  • Testing and the industrialization of the development
The last type of reader is the architect, the designer, the information system project leader or person responsible for pre-sales.

This particular reader will acquire a birds-eye view of the system and learn how to combine the components together. The book will help him obtain a high-level vision of the system that will allow him to define the architecture of new Android application, know the full extent of services that the platform offers and create an estimate of the work to be done.

Nevertheless, regardless of whatever category of reader might apply best to your profile, it is preferable that you have a minimum amount of knowledge concerning :
  • Objet programming, knowing Java is even better.
  • Using Eclipse (installing, setting up a workspace,...)
If you have no knowledge concerning these two subjects but you are still interested in programming with Android, this book is also for you! You will begin to improve your skills but it will require more work and effort. But just think of how much pleasure you will get from seeing your first application available on AndroidStore or simply installed on you own mobile phone.

Table of Content

Android, A Quick Course............................................................................................................... 6
1 Introduction .................................................................................................................................... 9
1.1 Who is this book for?............................................................................................................. 10
1.2 Content ................................................................................................................................. 11
1.3 The structure of the book ...................................................................................................... 12
1.4 Conventions ........................................................................................................................... 13
1.5 Your workspace ..................................................................................................................... 13

The Graphical User Interface ................................................................................................................. 14
2 Fundamentals ............................................................................................................................... 14
2.1 An Android application .......................................................................................................... 14
2.2 Project structure .................................................................................................................... 15
3 The GUI’s Activities ........................................................................................................................ 16
3.1 Using XML layouts ................................................................................................................. 16
3.2 Containers ............................................................................................................................. 17
3.3 Elementary widgets ............................................................................................................... 17
3.4 Selection widgets ................................................................................................................... 21
3.5 Containers and evolved widgets ........................................................................................... 26
3.6 Methods for sizing text: Physical or software keyboard ....................................................... 36
3.7 Menus ................................................................................................................................... 38
3.8 Typefaces ............................................................................................................................... 44
3.9 Integrating the WebKit navigator to an activity: the WebView widget ................................ 45
3.10 Pop-up messages: Toast and AlertDialog .............................................................................. 46
4 Manifest.xml and the layouts file .................................................................................................. 47
4.1 The layouts file ...................................................................................................................... 47

The heart of the system ........................................................................................................................ 48
5 Managing activities ........................................................................................................................ 48
5.1 Threads ................................................................................................................................. 48
5.2 Managing events relative to an activity’s life cycle ............................................................... 54
5.3 Intent filters ........................................................................................................................... 58
5.4 Rotation ................................................................................................................................ 69
6 Resources ..................................................................................................................................... 70
6.1 Resource files ........................................................................................................................ 70
6.2 Managing preferences ........................................................................................................... 81
6.3 Local Databases ..................................................................................................................... 84
6.4 Files ....................................................................................................................................... 99
7 My application is a ContentProvider ........................................................................................... 103
7.1 Using a ContentProvider ..................................................................................................... 104
7.2 Definition of a ContentProvider .......................................................................................... 109
8 My application is a Service .......................................................................................................... 120
8.1 Using a service ..................................................................................................................... 120
8.2 Creating a service ................................................................................................................ 122
9 The manifest.xml file ................................................................................................................... 124

Communicating with the system ......................................................................................................... 126
10 Communicating outside of the activity ....................................................................................... 126
10.1 The internet ......................................................................................................................... 126
10.2 Permissions .......................................................................................................................... 135
10.3 Geo-localization ................................................................................................................... 138
10.4 MapView and MapActivity .................................................................................................. 142
10.5 Managing phone calls and SMS ........................................................................................... 146
10.6 Multimedia files and the camera ........................................................................................ 154
10.7 Managing Bluetooth, networks and WIFI............................................................................ 158
10.8 Interacting with the sensors ................................................................................................ 179

An Android project’s life cycle ............................................................................................................. 186
11 Installing a workspace ................................................................................................................. 186
11.1 Downloads ........................................................................................................................... 186
11.2 Setting up Eclipse ................................................................................................................ 187

Exhaustive Table Of Content ............................................................................................................... 192

Bibliography ........................................................................................................................................ 200
12 Books .......................................................................................................................................... 200
13 Online references: ....................................................................................................................... 200

Major Remark

This EBook is the first part of the book "Android, A Complete Course, From Basics to Enterprise Edition". It's dedicated to pure Android programmation and doesn't focused on application's life cycle. It grant you to be autonomous and efficient in Android application development.

You are here Ebooks Android, A Quick Course