Book Image

Learning Android Intents

By : Muhammad Usama bin Aftab, Wajahat Karim
Book Image

Learning Android Intents

By: Muhammad Usama bin Aftab, Wajahat Karim

Overview of this book

<p>Android is an emerging technology with loads of apps in the Google Play Market. Till date, it is the biggest marvel in Smartphone technology, propelling a larger number of developers into Android application development. Intent is an essential part of any Android Application and no Android application is complete without using them. Features such as listening broadcasts, sending messages, sharing via social networks, notifications, hardware components including camera, sensors, Wi-Fi, and more, can be used in your applications by using Intents.</p> <p>This practical guide focuses on using intents to make the best use of various features of Android platform. It is ideal for those developers who want to understand the backbone and the domain of Android Intents, its power, and the need for it inside an Android application. Practical, in-depth examples are used throughout the book, to help you understand the key concepts.</p> <p>The book starts with introducing the very basic concepts of Android, and its various facts and figures such as different Android versions, their release dates, evolution of Android phones and so on. While covering the basic technical concepts, it proceeds from the easiest route of introducing Android Intents towards the more practical view of Android Intents in terms of components and features.</p> <p>You will learn how to use different components and features such as transfer data between activities, invoke various features and components of Android, execute different in-built and custom-made services, use hardware and software components of Android device, and start Pending Intents &amp; notifications. You will gain better theoretical knowledge of what is running behind the concepts of Android Intents, and practical knowledge of the mobile-efficient ways to perform a certain task using Android Intents.</p> <p>Towards the end, you will have a clear vision and a practical grip on Android intents and its features. Learning Android Intents is a proper guide to give you the best knowledge of Intents.</p>
Table of Contents (16 chapters)
Learning Android Intents
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Methods of data transfer between activities


In this section, we will get started with the various data transfer techniques that are used in an Android application. The techniques have their own pros and cons. There are a total of three methods to transfer data explicitly from one activity to another. We will see them shortly along with their examples. The three methods are as follows:

  • Data transfer using putExtras()

  • Data transfer using Parcelable (only applicable to custom data objects)

  • Data transfer using Serializable (only applicable to custom data objects)

Data transfer using putExtras()

In Android, the simplest way to transfer data from one activity to another is by sending it through extras. The intent extras support primitive data types to send the data. This means that you can send the data in the form of different data types such as String, Boolean, Integer, or Float.

Theoretically explaining, intent extras can be found inside the Intent class in the Android API. Developers need to make...