Book Image

Android 4: New Features for Application Development

By : Murat Aydin
Book Image

Android 4: New Features for Application Development

By: Murat Aydin

Overview of this book

<p>Recently, with the increasing popularity of mobile phones, mobile operating systems have emerged and quickly spread. Now people with smart phones can do everything that they can do with their computers. The popularity of the Android mobile operating system has increased and is widely used. In this book, new features and innovations of Android 4.0 will be discussed.<br /><br />"Android 4: New Features for Application Development" is a practical and hands-on guide for developing android applications using new features of Android Ice Cream Sandwich (Android 4.0) with a step-by-step approach and clearly explained sample codes. You will learn the new APIs in Android 4.0 with sample code.<br /><br />This book will cover the new features and APIs of Android 4.0 (Android Ice Cream Sandwich). It will show the usage of the new APIs with a step-by-step approach and clearly explained sample code.<br /><br />You will learn about the new user interface components such as Action Bar and GridLayout. You will also learn about new APIs for social media integration and accessing calendar data. We will also look at new connectivity APIs such as Wi-Fi Direct and Android Beam. Supporting multiple screen sizes and multiple versions of Android is also among the subjects that you will learn.<br /><br />You can use "Android 4: New Features for Application Development" as a reference book for developing Android applications using new features of Android 4.0 with its clearly explained, step-by-step sample codes.</p>
Table of Contents (15 chapters)

Preface

This book is a practical and hands-on guide for developing Android applications using new features of Android Ice Cream Sandwich (Android 4.0), with a step-by-step approach and clearly explained sample codes. You will learn the new APIs in Android 4.0 with these sample codes.

What this book covers

Chapter 1, Action Bar for All, introduces us to the action bar and shows us how to use and configure the action bar.

Chapter 2, A New Layout – GridLayout, introduces us to GridLayout and shows us how to use and configure GridLayout. GridLayout is a new layout introduced with Android Ice Cream Sandwich. This layout is an optimized layout and could be used instead of LinearLayout and RelativeLayout.

Chapter 3, Social APIs, covers the Social APIs that were introduced with Android Ice Cream Sandwich. This API makes it easy to integrate the social networks. Furthermore, high resolution photos can now be used as a contact's photo after Ice Cream Sandwich was released. This chapter shows Social API usage with examples.

Chapter 4, Calendar APIs, covers the Calendar APIs which were introduced with Android Ice Cream Sandwich for managing calendars. Event, attendee, alert, and reminder databases can be managed with these APIs. These APIs allow us to easily integrate calendars with our Android applications. This chapter shows how to use Calendar APIs with examples.

Chapter 5, Fragments, introduces us to the basics of fragments and how to use them.

Chapter 6, Supporting Different Screen Sizes, introduces us to the ways of designing user interfaces that support different screen sizes.

Chapter 7, Android Compatibility Package, introduces us to the Android Compatibility Package and shows us how to use it. The Android Compatibility Package is to allow the porting of the new APIs to the older versions of the Android platform.

Chapter 8, New Connectivity APIs – Android Beam and Wi-Fi Direct, introduces us to Android Beam, which uses the NFC hardware of the device and Wi-Fi Direct which allows devices to connect to each other without using wireless access points. This chapter will teach us the usage of Android Beam and Wi-Fi Direct.

Chapter 9, Multiple APK Support, introduces us to Multiple APK Support which is a new option in Google Play (Android Market) by which multiple versions of APKs could be uploaded for a single application.

This chapter is available for download at http://www.packtpub.com/sites/default/files/downloads/Multiple_APK_Support.pdf.

Chapter 10, APIs with Android Jelly Bean, covers Android Jelly Bean and the new APIs within it.

This chapter is available for download at http://www.packtpub.com/sites/default/files/downloads/Android_JellyBean.pdf.

What you need for this book

To follow the examples in this book, the Android Development Tools should be set up and ready. The necessary software list is as follows:

  • Eclipse with ADT plugin

  • Android SDK Tools

  • Android platform tools

  • The latest Android platform

The Operating Systems that can be used are as follows:

  • Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)

  • Mac OS X 10.5.8 or later (x86 only)

  • Linux (tested on Ubuntu Linux, Lucid Lynx)

    • GNU C Library (glibc) 2.7 or later is required

    • On Ubuntu Linux, version 8.04 or later is required

    • 64-bit distributions must be capable of running 32-bit applications

The specifications for use of the Eclipse IDE is as follows:

  • Eclipse 3.6.2 (Helios) or greater (Eclipse 3.5 (Galileo) is no longer supported with the latest version of ADT)

  • Eclipse JDT plugin (included in most Eclipse IDE packages)

  • JDK 6 (JRE alone is not sufficient)

  • Android Development Tools plugin (recommended)

Who this book is for

This book is for developers who are experienced with the Android platform, but who may not be familiar with the new features and APIs of Android 4.0.

Android developers who want to learn about supporting multiple screen sizes and multiple Android versions; this book is also for you.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Implement onCreateOptionsMenu and onOptionsItemSelected methods."

A block of code is set as follows:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/settings" android:title="Settings">
    </item>
    <item android:id="@+id/about" android:title="About">
    </item>
    
</menu>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

@Override
public void onPrepareSubMenu(SubMenu subMenu) {
  //In order to add submenus, we should override this method we dynamically created submenus
    subMenu.clear();
    subMenu.add("SubItem1").setOnMenuItemClickListener(this);
    subMenu.add("SubItem2").setOnMenuItemClickListener(this);
  }

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the Insert button and then click on the List button".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

The source code will also be available on the author's website at www.ottodroid.net.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.