Master Android from first principles and begin the journey toward your own successful Android applications!
Dear Reader,
First, welcome to the world of Android! We’re entering a new era of mobile application development, one marked by open platforms and open source, to take ‘walled gardens’ and make them green houses for any and all to participate in. Android is relatively easy for developers, and I believe that this innovation will help generate a large ecosystem of developers and consumers within a very short time. This means that budding developers such as yourself will have many opportunities to design and build your own applications and you’ll have a huge and hungry customer base.
Second, welcome to the book! Its purpose is to start you on your way with building Android applications, and to help you master the learning curve. Android is already a rich framework, comparable in many ways to the richness Android of desktop Java environments. This means that there is a lot of cool stuff for you to pick up along your journey in order to create the slickest, most useful apps Android you can imagine.
The source code for the code samples in this book is all available from the Apress site, so you can stay as hands-on and practical as you like while I introduce you to the core of Android, and invite you to experiment with the various classes and APIs we’ll be looking at. By the time you’ve finished this book, you’ll be creating your own Android applications and asking yourself what your next great application will be…!
Enjoy!
Mark Murphy
Next, Some Typing
Next, Some Typing
Next you need to come up with some MIME types corresponding with the content from your content provider.
Android uses both the content Uri and the MIME type as ways to identify content on the device. A collection content Uri
— or, more accurately, the combination authority and data type path — should map to a pair of MIME types. One MIME type will represent the collection; the other will represent an instance. These map to the Uri
patterns discussed in the previous section for no-identifier and identifier cases, respectively. As you saw in Chapters 24 and 25, you can fill a MIME type into an Intent
to route the Intent
to the proper activity (e.g., ACTION_PICK
on a collection MIME type to call up a selection activity to pick an instance out of that collection).
The collection MIME type should be of the form vnd.X.cursor.dir/Y
, where X
is the name of your firm, organization, or project, and Y
is a dot-delimited type name. So, for example, you might use vnd.tlagency.cursor.dir/sekrits.card.pin
as the MIME type for your collection of secrets.
The instance MIME type should be of the form vnd.X.cursor.item/Y
, usually for the same values of X
and Y
as you used for the collection MIME type (though that is not strictly required).