Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Android 9 Development Cookbook
Android 9 Development Cookbook

Android 9 Development Cookbook: Over 100 recipes and solutions to solve the most common problems faced by Android developers , Third Edition

eBook
$9.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Android 9 Development Cookbook

Activities

This chapter covers the following recipes:

  • Declaring an activity
  • Starting a new activity with an intent object
  • Switching between activities
  • Passing data to another activity
  • Returning a result from an activity
  • Saving an activity's state
  • Storing persistent activity data
  • Understanding the activity life cycle

Introduction

The Android SDK provides a powerful tool to program mobile devices, and the best way to master such a tool is to jump right in. Although you can read this book from beginning to end, as it is a cookbook, it is specifically designed to allow you to jump to specific tasks and get the results immediately.

Activities are the fundamental building block of most Android applications as the activity class provides the interface between the application and screen. Most Android applications will have at least one activity, if not several (but they are not required). A background service application will not necessarily require an activity if there is no user interface.

This chapter explains how to declare and launch activities within an application and how to manage several activities at once by sharing data between them, requesting results from them, and calling one activity from within another.

This chapter also briefly explores the intent object, which is often used in conjunction with activities. Intents can be used to transfer data between activities in your own application, as well as in external applications, such as those included with the Android operating system (a common example would be to use an intent to launch the default web browser).

To begin developing Android applications, head over to the Android Studio page to download the new Android Studio IDE and the Android SDK bundle:
http://developer.android.com/sdk/index.html.

Declaring an activity

Activities and other application components, such as services, are declared in the AndroidManifest.xml file. Declaring an activity node is how we tell the OS about our Activity class and how it can be requested. For example, an application will usually indicate that at least one activity should be visible as a desktop icon and serve as the main entry point to the application.

Getting ready

Android Studio, now at version 3.2, is used for all the code samples shown in this book. If you have not already installed it, visit the Android Studio website (see the link in the previous tip) to install the IDE and the SDK bundle for your platform.

How to do it...

For this first example, we'll guide you through creating a new project. Android Studio provides a Quick Start wizard, which makes the process extremely easy. Follow these steps to get started:

  1. Launch Android Studio, which brings up the Welcome to Android Studio dialog:

  1. Click on the Start a new Android Studio project option.
  2. Enter an application name; for this example, we used DeclareAnActivity. Click on Next:

  1. In the Target Android Devices dialog, you can leave the Phone and Tablet checkbox selected with the default API 21: Android 5.0 (Lollipop) selection for the minimum SDK (for this example, it really doesn't matter which API level you choose, as activities have existed since API level 1). Click on Next:

  1. In the Add an Activity to Mobile dialog, select the Empty Activity option. Click on Next:

  1. In the Configure Activity dialog, you can leave the defaults as provided, but note that the default activity name is MainActivity. Click on Finish:

After finishing the wizard, Android Studio will create the project files. For this recipe, the two files that we will examine are MainActivity.java (which corresponds to the activity name mentioned in step 6) and AndroidManifest.xml.

If you take a look at the MainActivity.java file, you will realize that it's pretty basic. This is because we chose the Empty Activity option (in step 5). Now, look at the AndroidManifest.xml file. This is where we actually declare the activity. Within the <application> element is the <activity> element:

<activity android:name=".MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name=
"android.intent.category.LAUNCHER"/> </intent-filter> </activity>
When viewing this xml in Android Studio, you may notice that the label element shows the actual text (DeclareAnActivity in this case) as defined in the strings.xml resource file.

How it works...

Declaring an activity is a simple matter of declaring the <activity> element and specifying the name of the activity class with the android:name attribute. By adding the <activity> element to the Android Manifest, we are specifying our intention to include this component in our application. Any activities (or any other component for that matter) that are not declared in the manifest will not be available to the application. Attempting to access or utilize an undeclared component will result in an exception being thrown at runtime.

In the preceding code, there is another attribute: android:label. This attribute indicates the title shown on the screen, as well as the icon if this is the Launcher activity.

For a complete list of available Activity attributes, take a look at this resource:
http://developer.android.com/guide/topics/manifest/activity-element.html.

Starting a new activity with an intent object

The Android application model can be seen as a service-oriented one, with activities as components and intents as the messages sent between them. Here, an intent is used to start an activity that displays the user's call log, but intents can be used to do many things and we will encounter them throughout this book.

Getting ready

To keep things simple, we are going to use an intent object to start one of Android's built-in applications rather than create a new one. This only requires a very basic application, so start a new Android project with Android Studio and call it ActivityStarter.

How to do it...

Again, to keep the example simple so that we can focus on the task at hand, we will create a function to show an intent in action and call this function from a button on our activity.

Once your new project is created in Android Studio, follow these steps:

  1. Open the MainActivity.java class and add the following function:
public void launchIntent(View view) { 
    Intent intent = new Intent(Intent.ACTION_VIEW); 
    intent.setData(Uri.parse("https://www.packtpub.com/")); 
    startActivity(intent); 
} 
  • While you are typing this code, Android Studio will give this warning on View and intent: Cannot resolve symbol 'Intent'.
  • This means that you need to add the library reference to the project. You can do this manually by entering the following code in the import section:
        import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
Alternatively, let Android Studio add the library reference for you: just click on the code highlighted with a red font and press Alt + Enter.
  1. Open the activity_main.xml file and replace the <TextView /> block with the following XML:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Launch Browser"
android:id="@+id/button"
android:onClick="launchIntent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
  1. Now, it's time to run the application and see the intent in action. You will need to either create an Android emulator (in Android Studio, go to Tools Android AVDManager) or connect a physical device to your computer.
  2. When you press the Launch Browser button, you will see the default web browser open with the URL specified.

How it works...

Though simple, this app demonstrates much of the power behind the Android OS. An intent is a message object. Intents can be used to communicate across your application's components (such as services and broadcast receivers) as well as with other applications on the device. In this recipe, we asked the OS to start any app that could handle the data we specified with the setData() method. (If the user has multiple browsers installed and no default set, the OS will show a list of apps for the user to choose from.)

To test this on a physical device, you may need to install drivers for your device (the drivers are specific to the hardware manufacturer). You will also need to enable Developer Mode on your device. Enabling Developer Mode varies according to the Android OS version. If you do not see the Developer Mode option in your device settings, open the About Phone option and begin tapping Build Number. After three taps, you should see a Toast message telling you that you are on your way to being a developer. Four more taps will enable the option.

In this recipe, we created an intent object with the ACTION_VIEW . as what we want to do (our intention). You may have noticed that when you typed Intent and the period, Android Studio provided a pop-up list of possibilities (this is the autocomplete feature), like this:

ACTION_VIEW, along with a URL in the data, indicates that the intention is to view the website, so the default browser is launched (different data could launch different apps). In this example, we just want to open a browser with the specified URL, so we call the startActivity() method. There are other ways to call the intent depending on our needs. In the Returning a result from an activity recipe, we will use the startActivityForResult() method.

There's more...

It's very common for Android users to download their favorite apps for web browsing, taking photos, text messaging, and so on. Using Intents, you allow your users to use their favorite apps instead of trying to reinvent all of this functionality.

See also

To start an activity from a menu selection, refer to the Handling menu selections recipe in Chapter 4, Menus and Action Mode.

Switching between activities

Often, we will want to activate one activity from within another activity. Although this is not a difficult task, it will require a little more setting up to be done than the previous recipes as it requires two activities. We will create two activity classes and declare them both in the manifest. We'll also create a button, as we did in the previous recipe, to switch to the activity.

Getting ready

We'll create a new project in Android Studio, just as we did in the previous recipes, and call this one ActivitySwitcher. Android Studio will create the first activity, ActivityMain, and automatically declare it in the manifest.

How to do it...

  1. Since the Android Studio New Project wizard has already created the first activity, we just need to create the second activity. Open the ActivitySwitcher project and navigate to File | New | Activity | Empty Activity, as shown in this screenshot:
  1. In the New Android Activity dialog, you can leave the default Activity Name as is, or change it to SecondActivity, as follows:
  1. Open the MainActivity.java file and add the following function:
    public void onClickSwitchActivity(View view) { 
        Intent intent = new Intent(this, SecondActivity.class); 
        startActivity(intent); 
    }
  1. Now, open the activity_main.xml file located in the res/layout folder and replace the <TextView /> with the following XML to create the button:
    <Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:text="Launch Second Activity"
android:onClick="onClickSwitchActivity"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
  1. You can run the code at this point and see the second activity open. We're going to go further and add a button to SecondActivity to close it, which will bring us back to the first activity. Open the SecondActivity.java file and
    add this function:
    public void onClickClose(View view) { 
        finish(); 
    } 
  1. Finally, add the Close button to the SecondActivity layout. Open the activity_second.xml file and add the following <Button> element to the auto-generated ConstraintLayout
    <Button
android:id="@+id/buttonClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Close"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:onClick="onClickClose"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
  1. Run the application on your device or emulator and see the buttons in action.

How it works...

The real work of this exercise is in the onClickSwitchActivity() method from step 3. This is where we declare the second activity for the Intent using SecondActivity.class. We went one step further by adding the close button to the second activity to show a common real-world situation: launching a new activity, then returning to the original calling activity. This behavior is accomplished in the onClickClose() function. All it does is call finish(), but that tells the OS that we're done with the activity. Finish doesn't actually return us to the calling activity (or any specific activity for that matter); it just closes the current activity and relies on the application's back stack to show the last activity. If we want a specific activity, we can again use the Intent object and specify the activity class name when creating the Intent.

This activity switching does not make a very exciting application. Our activity does nothing but demonstrates how to switch from one activity to another, which of course will form a fundamental aspect of almost any application that we develop.

If we had manually created the activities, we would need to add them to the manifest. Using the New Android Activity wizard will automatically add the necessary elements to the Android Manifest file. To see what Android Studio did for you, open the AndroidManifest.xml file and look at the <application> element:

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondActivity"></activity>

One thing to note in the preceding auto-generated code is that the second activity does not have the <intent-filter> element. The main activity is generally the entry point when starting the application. That's why MAIN and LAUNCHER are defined so that the system will know which activity to launch when the application starts.

See also

  • To learn more about embedding widgets such as the Button, visit Chapter 2, Views, Widgets, and Styles

Passing data to another activity

The intent object is defined as a messaging object. As a message object, its purpose is to communicate with other components of the application. In this recipe, we'll show you how to pass information with the intent and how to get it out again.

Getting ready

This recipe will pick up from where the previous one ended. We will call this project SendData.

How to do it...

Since this recipe is building on the previous recipe, most of the work is already done.  We'll add an EditText element to the main activity so that we have something to send to SecondActivity. We'll use the (auto-generated) TextView view to display the message. The following are the complete steps:

  1. Open activity_main.xml and add the following <EditText> element above the button:
<EditText
android:id="@+id/editTextData"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/button" />

The <Button> element that we created in the previous recipe doesn't change.

  1. Now, open the MainActivity.java file and change the onClickSwitchActivity() method as follows:
public void onClickSwitchActivity(View view) { 
    EditText editText = (EditText)findViewById(R.id.editTextData); 
    String text = editText.getText().toString(); 
    Intent intent = new Intent(this, SecondActivity.class); 
    intent.putExtra(Intent.EXTRA_TEXT,text); 
    startActivity(intent); 
}
  1. Next, open the activity_second.xml file and add the following <TextView> element:
<TextView
android:id="@+id/textViewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/buttonClose"/>
  1. The last change is to edit the second activity to look for this new data and display it on the screen. Open SecondActivity.java and edit onCreate() as follows:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
TextView textView = (TextView) findViewById(R.id.textViewText);
if (getIntent() != null && getIntent().hasExtra(Intent.EXTRA_TEXT)) {
textView.setText(getIntent().getStringExtra(Intent.EXTRA_TEXT));
}
}
  1. Now, run the project. Type some text in the main activity and press Launch Second Activity to see it send the data.

How it works...

As expected, the Intent object is doing all the work. We created an intent just as in the previous recipe and then added some extra data. Did you notice the putExtra() method call? In our example, we used the already defined Intent.EXTRA_TEXT as the identifier, but we didn't have to. We can use any key we want (you've seen this concept before if you're familiar with name/value pairs).

The key point about using name/value pairs is that you have to use the same name to get the data back out. That's why we used the same key identifier when we read the extra data with getStringExtra().

The second activity was launched with the intent that we created, so it's simply a matter of getting the intent and checking for the data sent along with it. We do this in onCreate():

textView.setText(getIntent().getStringExtra(Intent.EXTRA_TEXT)); 

There's more...

We aren't limited to just sending String data. The intent object is very flexible and already supports basic data types. Go back to Android Studio and click on the putExtra method. Then, hit Ctrl and the spacebar. Android Studio will bring up the auto-complete list so that you can see the different data types that you can store.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Uncover the latest features in Android 9 Pie to make your applications stand out
  • Develop Android Pie applications with the latest mobile technologies, from set up to security
  • Get up-to-speed with Android Studio 3 and its impressive new features

Description

The Android OS has the largest installation base of any operating system in the world. There has never been a better time to learn Android development to write your own applications, or to make your own contributions to the open source community! With this extensively updated cookbook, you'll find solutions for working with the user interfaces, multitouch gestures, location awareness, web services, and device features such as the phone, camera, and accelerometer. You also get useful steps on packaging your app for the Android Market. Each recipe provides a clear solution and sample code you can use in your project from the outset. Whether you are writing your first app or your hundredth, this is a book that you will come back to time and time again, with its many tips and tricks on the rich features of Android Pie.

Who is this book for?

If you are new to Android development and want to take a hands-on approach to learning the framework, or if you are an experienced developer in need of clear working code to solve the many challenges in Android development, you will benefit from this book. Either way, this is a resource you'll want to keep on your desk as a quick reference to help you solve new problems as you tackle more challenging projects.

What you will learn

  • Develop applications using the latest Android framework while maintaining backward-compatibility with the support library
  • Create engaging applications using knowledge gained from recipes on graphics, animations, and multimedia
  • Work through succinct steps on specifics that will help you complete your project faster
  • Add location awareness to your own app with examples using the latest Google Play services API
  • Utilize Google Speech Recognition APIs for your app

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 19, 2018
Length: 464 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788622967
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Oct 19, 2018
Length: 464 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788622967
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 131.97
Android Programming for Beginners
$48.99
Android 9 Development Cookbook
$43.99
Android Programming with Kotlin for Beginners
$38.99
Total $ 131.97 Stars icon
Banner background image

Table of Contents

17 Chapters
Activities Chevron down icon Chevron up icon
Layouts Chevron down icon Chevron up icon
Views, Widgets, and Styles Chevron down icon Chevron up icon
Menus and Action Mode Chevron down icon Chevron up icon
Fragments Chevron down icon Chevron up icon
Home Screen Widgets, Search, and the System UI Chevron down icon Chevron up icon
Data Storage Chevron down icon Chevron up icon
Alerts and Notifications Chevron down icon Chevron up icon
Using the Touchscreen and Sensors Chevron down icon Chevron up icon
Graphics and Animation Chevron down icon Chevron up icon
A First Look at OpenGL ES Chevron down icon Chevron up icon
Multimedia Chevron down icon Chevron up icon
Telephony, Networks, and the Web Chevron down icon Chevron up icon
Location and Using Geofencing Chevron down icon Chevron up icon
Getting Your App Ready for the Play Store Chevron down icon Chevron up icon
Getting Started with Kotlin Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.4
(9 Ratings)
5 star 55.6%
4 star 0%
3 star 11.1%
2 star 0%
1 star 33.3%
Filter icon Filter
Top Reviews

Filter reviews by




Christopher Adamson Jan 26, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I like the cookbook style from Packt, and it makes sense for Android development in general. It was a good read.
Amazon Verified review Amazon
Josh May 07, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm very impressed with this book. The author gets straight to the point, and covers plenty of information without covering too much or too little. I highly recommend this book.
Amazon Verified review Amazon
Sand George Ionut Nov 05, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
good
Amazon Verified review Amazon
Paul Plachetka Aug 06, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Das Buch ist äußerst einfach verständlich für Leute die nicht gerade neu in Java sind und komplett von vorn mit Android Development beginnen wollen. Auch wenn es um Android 9 geht, ist es ziemlich aktuell, in Android 10 ist jetzt nicht sehr viel dazu gekommen. Die Kapitel sind von Einführung, über erste Elemente und Konzepte zu komplexeren Techniken geordnet und sind gut verständlich. Ich bin zwar noch nicht durch mit dem Buch, dennoch lässt sich auch bedingt durch die simple IDE, die Einem schon viel abnimmt, sehr viel selbst anfangen. Das einzige Manko das ich hätte, wäre, dass die Bebilderung in Schwarz-Weiß ist und die IDE im Dark Mode abbildet, was das erkennen von vermeintlich gemeinten Details in der IDE sehr schwer macht.
Amazon Verified review Amazon
Ein Kunde Jul 31, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Ich versuche bereits seit etwa zwei Jahren den Einstieg in die Android-Programmierung zu finden. Angeblich soll die Android-Programmierung mit Android-Studio schwierig und komplex sein. Um die Programmierung zu lernen habe ich mich durch ein relativ gut bewertetes deutschsprachiges Buch bis auf Seite 153 gequält und trotz mehrfacher Anläufe, Wiederholung der bereits gelesenen Abschnitte, markieren mit einem Farbmarker etc. einfach kein Bein auf den Boden gekriegt. Auch die Bewertungen der anderen deutschsprachigen Bücher ließen nichts besseres erwarten.Nun habe ich mir dieses englischsprachige Buch besorgt und in knapp einer Stunde die ersten vier "Programmierrezepte" durchprobiert. Der Lernerfolg kann einfach nur als gigantisch bezeichnet werden. Ich habe in dieser einen Stunde mehr gelernt, als in den vielen, vielen frustrierenden Stunden mit meinem deutschen Buch.Das Buch ist hierbei so aufgebaut, dass dieses viele kleine Programmbeispiele aufweist, die teilweise aufeinander aufbauen. Die Programmierbeispiele sind kurz und übersichtlich und enthalten jeweils eine Schritt für Schritt-Anleitung mit allen wichtigen Schritten. Es setzt die Strategie "Teile und Herrsche" perfekt um. Durch die Kürze der Beispiele ergibt sich ein phänomenaler Lerneffekt, weil extrem prägnant die tatsächlich nicht ganz trivialen Zusammenhänge zwischen den einzelnen Dateien eines Android Studio Projektes herausgearbeitet werden.Ob das Buch etwas für komplette Programmieranfänger ist, kann ich nicht beurteilen. Wenn ihr aber schon etwas Programmiererfahrung habt und Euch englisch keine Probleme bereitet, kann ich Euch das Buch wärmstens empfehlen!Um Euch selbst ein Bild zu machen empfehle ich Euch die ersten beiden Programmierrezepte einfach mal selber auszuprobieren. Die ersten Seiten des Buches mit den ersten beiden Programmierrezepten sind bei Amazon online verfügbar.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.