Movatterモバイル変換


[0]ホーム

URL:


Packt
Search iconClose icon
Search icon CANCEL
Subscription
0
Cart icon
Your Cart(0 item)
Close icon
You have no products in your basket yet
Save more on your purchases!discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Profile icon
Account
Close icon

Change country

Modal Close icon
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timerSALE ENDS IN
0Days
:
00Hours
:
00Minutes
:
00Seconds
Home> Mobile> Android Development> Android Programming with Kotlin for Beginners
Android Programming with Kotlin for Beginners
Android Programming with Kotlin for Beginners

Android Programming with Kotlin for Beginners: Build Android apps starting from zero programming experience with the new Kotlin programming language

Arrow left icon
Profile Icon John Horton
Arrow right icon
€20.99€23.99
Full star iconFull star iconFull star iconHalf star iconEmpty star icon3.7(19 Ratings)
eBookApr 2019698 pages1st Edition
eBook
€20.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Table of content iconView table of contentsPreview book icon Preview Book

Android Programming with Kotlin for Beginners

Chapter 1. Getting Started with Android and Kotlin

Welcome tothe exciting world of Android and Kotlin! In this first chapter, we won't waste any time before getting started developing Android apps.

We will look at what is so great about Android, what Android and Kotlin are, how they work and complement each other, and what that means to us as future developers. Moving on, we will set up the required software, so that we can build and deploy a simple first app.

In this chapter, we will cover the following topics:

  • Learning how Kotlin and Android work together
  • Setting up our development environment, Android Studio
  • Learning what makes an android app
  • Learning about Kotlin
  • Building our very first Android app
  • Deploying an Android emulator
  • Running our app on an Android emulator and a real device

This is a lot to get through, so let's get started.

Why use Kotlin and Android?

When Androidfirst arrived in 2008, it was a bit drab compared to the muchmore stylish iOS on the Apple iPhone/iPad. But, quite quickly, through a variety of handset offers that struck a chord with practical, price-conscious consumers, as well as those who are fashion-conscious and tech-savvy, Android user numbers exploded.

For many, myself included, developing for Android is the most rewarding pastime and business, bar none.

Quickly putting together a prototype of an idea, refining it, and then deciding to run with it and wire it up into a fully-fledged app, is such an exciting and rewarding process. Any programming can be fun – I have been programming all my life – but creating for Android is somehow extraordinarily rewarding.

Definingexactly why this is the case is quite difficult. Perhaps it is the fact that the platform is free and open. You can distribute your apps without needingthe permission of a big controlling corporation – nobody can stop you. And, at the same time, you have well-established, corporate-controlled mass markets, such as Amazon Appstore and Google Play.

It is more likely, however, that the reason that developing for Android gives such a good feeling is the nature of the devices themselves. They are deeply personal. You can develop apps that interact with people's lives, which educate, entertain, tell a story, and so on, and it is there in their pocket ready to go – in the home, in the workplace, or on holiday.

You can certainly build something bigger for the desktop but knowing that thousands (or millions) of people are carrying your work in their pockets and sharing it with friends is more than just a buzz.

No longer is developing apps considered geeky, nerdy, or reclusive. In fact, developing for Android is considered highly skillful, and the most successful developers are hugely admired, even revered.

If all this fluffy, spiritual stuff doesn't mean anything to you, then that's fine too; developing for Android can make you a living, or even make you wealthy. With the continued growth of device ownership, the ongoing increase in CPU and GPU power, and the non-stop evolution of the Android operating system itself, the need for professional app developers is only going to grow.

In short, the best Android developers – and, more importantly, the Android developers with the best ideas and the most determination – are in greater demand than ever. Nobody knows whothese future Android app developers are, and they might not evenhave written their first line of code yet.

So, why isn't everybody an Android developer? Obviously, not everybody will share my enthusiasm for the thrill of creating software that can help make people's lives better, but I am guessing that, because you are reading this, you might.

The beginner's first stumbling block

Unfortunately, for those who do share my enthusiasm, there is a kind of glass wall on the path of progress that frustrates many aspiring Android developers.

Android asksaspiring developers to choose from three programming languages to make apps. Every Android book, even those aimed at so-called beginners, assumes that readers have at least an intermediate level of Kotlin, C++, or Java, and most need an advanced level. So, good-to-excellent programming knowledge is considered a prerequisite for learning Android.

Unfortunately, learning these languages in a completely different context to Android can sometimes be a little dull, and much of what you learn is not directly transferable into the world of Android either. You can see why beginners to Android are often put off.

It doesn't need to be like this. In this book, I have carefully placed all the Kotlin topics that you would learn in a thick and weighty Kotlin-only beginner's tome, and reworked them into three multi-chapter apps and more than a dozen quick mini-apps, starting from a simple memo app, progressing to a cool drawing app and a database app.

If you want to become a professional Android developer, or just want to have more fun when learning Kotlin and Android, this book will help.

How Kotlin and Android work together

TheAndroid Software Development Kit (SDK) is largelywritten in Java, becauseKotlin is the new kid on the block; but when we tell AndroidStudio to turn our Kotlin code into a working app, it is merged together with the Java from the SDK in an intermediate form before being converted into a format called DEX code, which the Android device uses to convert into a running app. This is seamless to us as developers, but it is worth knowing (and, perhaps, is quite interesting) to know what is going on behind the scenes.

Whether you have programmed your app in Kotlin or Java, the resulting DEX code is the same. However, there are some significant advantages to working with Kotlin.

Kotlin isnamed after an island near St Petersburg, Russia. Kotlin is very similar to Apple's Swift language, so learning Kotlin now will stand you in very good stead for learning iPhone/iPad development.

Kotlin isthe most succinct language, and therefore is the least error-prone, which is great for beginners. Kotlin is also the most fun language, mainly because the succinctness means you can get results faster and with less code. Google considers Kotlin an official (first-class) Android language. There are some other advantages to Kotlin that make it less error-prone and less likely to make mistakes that cause crashes. We will discover the details of these advantages as we proceed.

Loads of the most advanced, innovative, and popular apps were coded using Kotlin. Just a few examples include Kindle, Evernote, Twitter, Expedia, Pinterest, and Netflix.

Before westart our Android quest, we need to understand how Android and Kotlin work together. After we write a program for Android, either in Java or Kotlin, we click a button and our code is transformed into another form, a form that is understood by Android. This other form is calledDalvik Executable,orDEX code, and the transformation process is calledcompiling. When the app isinstalled on a device, the DEX code is transformed again by the operating system into an optimized executable state.

Note

We will see this process in action right after we set up our development environment later on in the chapter.

Android is a complex system, but you do not need to understand it in depth to be able to start making amazing apps.

Tip

A full understanding will come after using and interacting with it over time.

To get started, we only need to understand the basics. Android runs on a specially adaptedversion of the Linux operating system. So, what the user sees of Android is just an app running on yet another operating system.

Android isa system within a system. The typical Android user doesn't see the Linux operating system, and most probably doesn't even know it is there.

One purpose of this is to hide the complexity and diversity of the hardware and software that Android runs on, but, at the same time, exposing all its useful features. The exposureof these features works in two ways:

  • First, the operating system itself must have full access to the hardware, which it does.
  • Second, this access must be programmer-friendly and easy to use, and it is because of the Androidapplication programming interface (API).

Let's continue by looking further into the Android API.

The Android API

The Android APIis code that makes it easy to do exceptional things. A simple analogy could be drawn with a machine, perhaps a car. When you press on the accelerator, a whole bunch of things happen under the hood. We don't need to understandcombustion or fuel pumps, because some smart engineer has made aninterface for us; in this case, a mechanical interface – the accelerator pedal.

For example, the following line of code probably looks a little intimidating at this stage in the book, but it serves as a good example of how the Android API helps us:

locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)

Once you learn that this single line of code searches for available satellites in space, communicates with them in their orbits around the Earth, and then retrieves your precise latitude and longitude on the surface of the planet, it becomes easy to glimpse the power and depth of the Android API.

That code does look a little challenging, even mind-boggling at this stage of the book, but imagine trying to talk to a satellite some other way!

The Android APIhas a whole bunch of code that has already been written for us to use as we like.

The question we must ask, and the one this book tries to answer, is as follows: how do we use all this code to do cool stuff? Or, to frame the question to fit the earlier analogy: how do we find and manipulate the pedals, steering wheel, and, most importantly, the sunroof of the Android API?

The answer to this question is the Kotlin programming language, and the fact that Kotlin was designed to help programmers handle complexity, avoid mistakes, and make fast progress. Let's look deeper into Kotlin andobject-oriented programming (OOP).

Kotlin is object-oriented

Kotlin is anobject-oriented language. Thismeans that it uses the concept of reusable programming objects. If this sounds like technical jargon, another analogy will help. Kotlinenables us and others (like the Android API development team) to write code that can be structured based on real-world things, and here is the important part – it can bereused.

So, using the car analogy, we could ask the following question: if a manufacturer makes more than one car in a day, do they redesign every part for every car that comes off the production line?

The answer, of course, is no. They get highly skilled engineers to develop exactly the right components, honed, refined, and improved over years. Then, those same components are reused again and again, as well as being occasionally improved.

If you are going to be fussy about my analogy, then you can point out that each of the car's components must still be built from the raw materials using real-life engineers or robots. This is true.

What software engineers do when they write their code is build a blueprint for an object. We then create an object from their blueprint using code and once we have that object, we can configure it, use it, combine it with other objects, and more besides.

Furthermore, wecan design blueprints ourselves and make objects from them. The compilerthen transforms (manufactures) our bespoke creationinto DEX code. Hey presto! We have an Android app.

In Kotlin, a blueprintis called aclass. When a class is transformed into a real working "thing," we call it anobjector an instanceof the class.

Note

Objects in short.

We could go on making analogies all day long. As far as we care at this point, Kotlin (and most modern programming languages) is a language that allows us to write code once that can then be used repeatedly.

This is very useful because it saves us time, and allows us to use other people's code to perform tasks we might otherwise not have the time or knowledge to write for ourselves. Most of the time, we do not even need to see this code, or even know how it does its work!

One last analogy. We just need to know how to use that code, just as we need to learn how to drive a car.

So, some smart software engineers up at Android HQ write a desperately complex program that can talk to satellites, and as a result of this, in a single line of code, we can get our location on the surface of the planet. Nice.

Most of the Android API is written in another language (Java), but this doesn't matter to us as we have full access to the functionality (coded in Java) while using the more succinct Kotlin. Android Studio and the Kotlin compiler handle the complexities behind the scenes.

The software engineers have considered how they can make this code useful to all Android programmers who want to make amazing apps that use users' locations to do cool things. One of the things they will do is make features, such as getting the device's location in the world into a simple one-line task.

So, the singleline of code we saw previously sets in action many more lines of code that we don't see, and don't need to see. This is an example of using somebody else's code to make our code infinitely simpler.

Tip

If the fact that you don't have to see all the code is a disappointment to you, then I understand how you feel. Some of us, when we learn about something, want to learn every intricate detail. If this is you, then be reassured that the best place to start learning how the Android API works internally is to use it as the API programmers intended. And, throughout the book, I will regularly point out further learning opportunities where you can find out the inner workings of the Android API. Also, we will be writing classes that are themselves reusable, kind of like our own API, except that our classes will focus on what we want our app to do.

Welcome tothe world ofOOP. I will constantly refer to OOP in every chapter, and there will be a big reveal inChapter 10,Object-Oriented Programming.

Run that by me again – what, exactly, is Android?

To getthings done on Android, we write code of our own, which also uses the code of the Android API. This is then compiled into DEX code, and the rest is handled by the Android device, which, in turn, runs on an underlying operating system called Linux, which handles the complex and extremely diverse range of hardware that is the different Android devices.

The manufacturers of Android devices and of the individual hardware components obviouslyknow this too, and they write advanced software calleddrivers that ensure that their hardware (for example, CPU, GPU, GPS receivers, memory chips, and hardware interfaces) can run on the underlying Linux operating system.

The DEX code (along with some other resources) are placed in a bundle of files called anAndroid application package (APK), and this is what the device needs to run our app.

Tip

It is not necessary to remember the details of the steps that our code goes through when it interacts with the hardware. It is enough just to understand that our code goes through some automated processes to become the app that we will publish to the Google Play store.

The nextquestion is: where exactly does all this coding and compiling into DEX code, along with APK packaging, take place? Let's look at the development environment that we will be using.

Android Studio

Adevelopment environment is a term that refers to having everything you need to develop, setup and ready to go in one place.

There isan entire range of tools needed to develop for Android, and we also need the Android API, of course. This whole suite of requirements is collectively known as the SDK. Fortunately, downloading and installing a single applicationwill give us these things all bundled together. The application is called Android Studio.

Android Studio is anintegrated development environment (IDE) that will take care of all the complexities of compiling our code and linking with the Android API. Once we have installed Android Studio, we can do everything we need inside this single application, and put to the back of our minds many of the complexities we have been discussing.

Tip

Over time, these complexities will become second nature. It is not necessary to master them immediately to make further progress.

So, we had better get our hands on Android Studio.

Setting up Android Studio

Setting upAndroid Studio is quite straightforward, if a little time-consuming. Grab some refreshments and get started with the following steps:

  1. Visitdeveloper.android.com/studio/index.html. Click the bigDOWNLOAD ANDROID STUDIO button to proceed:
    Setting up Android Studio
  2. Accept the terms and conditions by checking the checkbox, and then click theDOWNLOAD ANDROID STUDIO FOR WINDOWS button:
    Setting up Android Studio
  3. When thedownload is complete, run the file you just downloaded. It has a name that startsandroid-studio-ide…,while the end of the name of the file will vary based on the current version at the time of reading.
  4. Click theNext > button to proceed:
    Setting up Android Studio
  5. Leave thedefault options selected, as shown in the following screenshot, and click theNext > button:
    Setting up Android Studio
  6. Next, we needto choose where to install Android Studio, as shown in the following screenshot:
    Setting up Android Studio

    The installwizard recommends500 MBof free space, but you probably noticed from the previous screen that 2.1 GB was suggested. However, there are even more requirements later in the installation process. Furthermore, it is much easier if you have all your Android Studio parts, as well as your project files, on the same hard drive.

    For these reasons, I recommend having at least 4 GB of free space. If you need to switch drives to accommodate this, then use theBrowse.. button to browse to a suitable place on your hard drive.

    Tip

    Note down the location that you choose.

  7. When you are ready, click theNext > button.
  8. In this next window, choose the folder in your start menu whereAndroid Studio will appear. You can leave it as the default, as follows:
    Setting up Android Studio
  9. ClickInstall. This step might take some time, especially on older machines or if youhave a slow internet connection. When this stage is done, you will see the following screen:
    Setting up Android Studio
  10. ClickNext >.
  11. Android Studiois now installed – kind of. Check theStart Android Studio checkbox and click theFinish button:
    Setting up Android Studio
  12. You willbe greeted with theWelcome screen, as shown in the following screenshot:
    Setting up Android Studio
  13. ClicktheNext button.
  14. Choose theStandard install type, as shown in the following screenshot:
    Setting up Android Studio
  15. Click theNext button.
  16. Choosewhichever color scheme looks nice to you. I choseIntelliJ, as shown in the following screenshot:
    Setting up Android Studio
  17. ClickNext.
  18. Now youwill see theVerify Settings screen:
    Setting up Android Studio
  19. Click theFinish button. Android Studio will now commence some more downloads, which could take some time.
  20. WhenAndroid Studio is ready, you will have the option to run it. At this point, click theFinish button. Android Studio is most likely ready. You can leave it open if you are carrying straight on with the next section, or you can close it and then reopen it when instructed to in the next section.

Final step – for now

Using yourpreferred file manager software, perhaps Windows Explorer, create a folder calledAndroidProjects. Make it at the root of the same drive where you installed Android Studio. So, if you installed Android Studio atC:/Program Files/Android, then create your new folder atC:/AndroidProjects.

Or, if you installed Android Studio atD:/Program Files/Android, then create your new folder atD:/AndroidProjects.

Tip

Note that the screenshots in the next section show theAndroidProjects folder on theD: drive. This is because myC: drive is a bit full up. Either is fine. I did the install tutorial screen captures on a borrowed PC with plenty of space on the C: drive, because that is the default for Android Studio. Keeping it on the same drive as the Android installation is neater and could avoid future problems, so do so if you can.

Notice that there is no space between the wordsAndroid andProjects, and that the first letter of both words is capitalized. The capitalization is for clarity, and the omission of a space is required by Android Studio.

AndroidStudio and the supporting tools that we need are installed and ready to go. We are now really close to building our first app.

Now, let's look a little bit at the composition of an Android app.

What makes an Android app?

We alreadyknow that we will write Kotlin code that will use other people's code, and that will be compiled into DEX code that is used on our users' Android devices. In addition to this, we will also be adding and editing other files that get included in the final APK. These files are known asAndroid resources.

Android resources

As mentionedearlier in this chapter, our app will include resources, such as images, sound, and user interface layouts, that are kept in separate files from the Kotlin code. We will slowly introduce ourselves to them over the course of the book.

They will also include files that have the textual content of our app. It is convention to refer to the text in our app through separate files because it makes them easy to change, and easy to create apps that work for multiple different languages and geographical regions.

Furthermore, the actual User Interface (UI) layout of our apps, despite the option to implementthem with a visual designer, are read from text-basedfiles by Android.

Android (or any computer) cannot read and recognize text in the same way that a human can. Therefore, we must present our resources in a highly organized and predefinedmanner. To do so, we will useExtensible Markup Language (XML). XML is a huge topic; fortunately, its whole purpose is to be both human- and machine- readable. We do not need to learn this language; we just need to note (and then conform to) a few rules. Furthermore, most of the time, when we interact with XML, we will do so through a neat visual editor provided by Android Studio. We can tell when we are dealing with an XML resource because the filename will end with the.xml extension.

You do not need to memorize this, as we will constantly be returning to this concept in the book.

The structure of Android's code

In additionto these resources, it is worth noting that Androidhas a structure to its code. There are many millions of lines of code that we can take advantage of. This code will obviously need to be organized in a way that makes it easy to find and refer to. It is organized intopackages that are specific to Android.

Packages

Wheneverwe create a new Android app, we will choose a uniquename, known as apackage. We will see how we do this very soon, in the section titledOur first Android app. Packages are often separated intosub-packages so thatthey can be grouped together with other similar packages. We can simply think of these as folders and sub-folders, which is almost exactly what they are.

We can think of all the packages that the Android API makes available to us as code from a code library. Some common Android packages that we will use include the following:

  • android.graphics
  • android.database
  • android.view.animation

As youcan see, they are arranged and named to make what is in them as obvious as possible.

Tip

If you want to get an idea of the sheer depth and breadth of the Android API, then look at the Android package index athttps://developer.android.com/reference/packages

Classes

Earlier, we learnedthat the reusable code blueprints that we can transform into objects are calledclasses. Classes are contained in these packages. We will seein our very first app how we can easilyimport other people's packages, along with specific classes from those packages for use in our projects. A class will usually be contained in its own file with the same name as the class.

Functions

In Kotlin,we further break up our classes into sections that perform the different actions of our class. We call these action-oriented sectionsfunctions. It is the functions of the class that we will use to access the functionality providedwithin all the millions of lines of Android code.

We do not need to read the code. We just need to know which class has what we need, which package it is in, and which function from within the class gives us precisely the result we are after.

We can think of the structure of the code we will write ourselves in the same way, although we will usually have just one package per app.

Of course, because of the object-oriented nature of Kotlin, we will only be using selectedparts from this API. Note also that each class has itsown distinctdata. Typically, if you want access to the data in a class, you need to have an object of that class.

Tip

You do not need to memorize this, as we will constantly be returning to this concept in the book.

By theend of this chapter, we will have imported multiple packages, as well as some classes from them. By the end ofChapter 2,Kotlin, XML, and the UI Designer, we will have even written our very own functions.

Our first Android app

Now wecan get started on our first app. In programming, it is tradition for the first app of a new student to use whatever language/OS they are using to say hello to the world. We will quickly build an app that does just that, and, inChapter 2,Kotlin, XML, and the UI Designer, we will go beyond that and add some buttons that respond to the user when they are clicked.

Note

The complete code as it stands at the end of this chapter is in the download bundle in theChapter01 folder for your reference. You can't simply copy and paste this code, however. You still need to go through the project creation phase explained in this chapter (and at the beginning of all projects) as Android Studio does lots of work behind the scenes. Once you become familiar with these steps and understand which code is typed by you, the programmer, and which code/files are generated by Android Studio, you will then be able to save time and typing by copying and pasting from the files I supply in the download bundle.

Follow these steps to start the project:

  1. Run Android Studio in the same way you run any other app. On Windows 10, for example, the launch icon appears in the start menu.

    Tip

    If you are prompted toImport Studio settings from…:, chooseDo not import settings.

  2. You willbe greeted with the Android Studio welcome screen, as shown in the following screenshot. Locate theStart a new Android Studio project option and left-click it:
    Our first Android app
  3. After this, Android Studio will bring up theChoose your project window, as follows:
    Our first Android app
  4. We will use theBasic Activity option, as selected in the previous screenshot. Android Studio will autogenerate some code and a selection of resources to get our project started. We will discuss the code and the resourcesin detail in the next chapter. SelectBasic Activity and clickNext.
  5. This next screen is theConfigure your project screen, where we will perform the following steps and a few more things as well:
    1. Name the new project
    2. Provide a company domain as a package name to distinguish our project from any others, in case we should ever decide to publish it on the Play Store
    3. Choose where on our computer the project files should go
    4. Select our preferred programming language
  6. The name of our project is going to beHello World, and the location for the files will be yourAndroidProjects folder that we created in theSetting up Android Studio section.
  7. The packagename can be almost anything you like. If you have a website, you could use thecom.yourdomain.helloworld format. If not, feel free to usecom.gamecodeschool.helloworld, or something that you just make up. It is only important when you come to publish it.
  8. To be clear, in case you can't see the details in the following screenshot clearly, here are the values I used. Remember that yours might vary depending upon your choice of company domain and project save location:

    Option

    Value entered

    Name:

    Hello World

    Package Name:

    com.gamecodeschool.helloworld

    Language:

    Kotlin

    Save location:

    D:\AndroidProjects\HelloWorld

    Minimum API Level:

    Leave at whatever the default is

    This project will support instant apps:

    Leave at whatever the default is

    Use AndroidX artifacts:

    Select this option

    Note

    Note that the application name has a space between "Hello" and "World," but the project location does not, and will not work if it does.

    Regarding theMinimum API level setting, we already know that the Android SDK is the collection of packages of code that we will be using to develop our apps. Like any good SDK, the Android SDK is regularly updated, and each time it gets a significant update, the version number is increased. Simply put, the higher the version number, the newer the features you get to use; the lower the version number, the more devices our app will work on. For now, the defaultAPI 15, Android 4.0.3 (IceCreamSandwich) version will give us lots of great features and near 100% compatibility with the Android devices currently in use. If, at the time of reading, Android Studio is suggesting a newer API, then go with that.

    If you are reading this some years in the future, then theMinimum API option will probably default to something different, but the code in this book will still work.

    The followingscreenshot shows theConfigure your project screen once you have entered all the information:

    Our first Android app

    Note

    You can write Android apps in a few different languages, including C++ and Java. There are various advantages and disadvantages to each compared to using Kotlin. Learning Kotlin will be a great introduction to other languages, and Kotlin is also the newest (and arguably best) official language of Android.

  9. Click theFinish button and Android Studio will prepare our new project for us. Thismight take a few seconds or a few minutes, depending upon how powerful your PC is.

    At this stage, you might be ready to proceed but, depending on the install process, you might need to click a couple of extra buttons.

    Tip

    This is why I mentioned that we are onlyprobably finished installing and setting up.

    Look in the bottom window of Android Studio and see if you have the following message:

    Note

    Note that if you do not see a horizontal window at the bottom of Android Studio like the one shown in the following screenshot, you can skip these two extra steps.

Possible extra step 1

Possible extra step 1

If you do, clickInstall missing platform(s) and sync project, accept the license agreement, andthen clickNext, followed byFinish.

Possible extra step 2

You mayget another message like this:

Possible extra step 2

If thepreceding message appears, clickInstall Build tools…. and then clickFinish.

Tip

You can tidy up the screen a bit and close this bottom horizontal window by clicking theMessages tab at the very bottom of Android Studio, but this isn't compulsory.

Deploying the app so far

Before weexplore any of the code and learn our first bit of Kotlin, you might be surprised to learn that we can already run our project. It will be a fairly featureless screen, but as we will be running the app as often as possible to check our progress, let's see how to do that now. You have three options:

  • Run the app on the emulator on your PC (part of Android Studio) in debug mode
  • Run the app on a real Android device in USB debugging mode
  • Export the app as a full Android project that can be uploaded to the Play Store

The first option (debug mode) is the easiest to set up, because we did it as part of setting up Android Studio. If you have a powerful PC, you will hardly see the difference between the emulator and a real device. However, screen touches are emulated by mouse clicks, and proper testing of the user experience is not possible in some of the later apps, such as the drawing app. Furthermore, you might just prefer to test out your creations on a real device – I know I do.

The second option, using a real device, has a couple of additional steps, but, once set up, is as good as option one, and the screen touches are for real.

The final option takes about five minutes (at least) to prepare, and then you need to manually put the created package onto a real device and install it (every time you make a change to the code).

The best way is probably to use the emulator to quickly test and debug minor increments in your code, and then use the USB debugging mode on a real device fairly regularlyto make sure things are still as expected. Only occasionally will you want to export an actual deployable package.

Tip

If you have an especially slow PC or a particularly aging Android device, you will be fine just running the projects in this book using just one option or the other. Note that a slow Android phone will probably be OK and cope, but a very slow PC will probably not handle the emulator running some of the later apps, and you will benefit from running them on your phone/tablet.

For these reasons, I will now go through how to run the app using the emulator and USB debugging on a real device.

Running and debugging the app on an Android emulator

Followthese simple steps to run the appon the default Android emulator:

  1. On the Android Studio main menu bar, selectTools |AVD Manager. AVD stands for Android Virtual Device (an emulator). You will see the following window:
    Running and debugging the app on an Android emulator
  2. Notice thatthere is an emulator in the list. In my case, it isPixel 2 XL API 28. If you are following thissometime in the future, it will be a different emulator that was installed by default. It won't matter. Click the green play icon (to the right) shown in the following screenshot, and wait while the emulator boots up:
    Running and debugging the app on an Android emulator
  3. Now you can click the play icon on the Android Studio quick-launch bar as shown in the following screenshot and, when prompted, choosePixel 2 XL API 28 (or whatever your emulator is called) and the app will launch on the emulator:
    Running and debugging the app on an Android emulator

You'redone. Here is what the app looks likeso far in the emulator. Remember that you might (probably do) have a different emulator, which is fine:

Running and debugging the app on an Android emulator

Clearly, wehave more work to do beforewe move to Silicon Valley and look for financial backing, but it is a good start.

We need to test and debug our apps often throughout development to check for any errors, crashes, or anything else unintended.

Note

We will see how we get errors and other feedback for debugging from our apps in the next chapter.

It is also important to make sure it looks good and runs correctly on every device type/size that you want to target. Obviously, we do not own one of each of the many thousands of Android devices. This is where emulators come in.

Emulators, however, are sometimes a bit slow and cumbersome, although they have improved a lot recently. If we want to get a genuine feel for the experience our user will get, then you can't beat deploying to a real device. So, we will want to use both real devices and emulators while developing our apps.

Tip

If you are planning on using the emulator again soon, leave it running to avoid having to wait for it to start again.

If you want to try out your app on a tablet, you're going to need a different emulator.

Note

Creating a new emulator

It is simple to create an emulator for a different Android device. From the main menu, selectTools| AVD Manager. In theAVD Manager window, left-clickCreate New Virtual Device. Now left-click on the type of device you want to create –TV,Phone,Wear OS, orTablet. Now simply left-clickNext and follow the instructions to create your new AVD. Next time you run your app, the new AVD will appear as an option to run the app on.

Now we can look at how we can get our app onto a real device.

Running the app on a real device

The firstthing to do is to visit your device manufacturer's website and obtain and install any drivers that are needed for your device and operating system.

Tip

Most newer devices won't need a driver, so you may want to just try the following steps first.

The next few steps will set up the Android device for debugging. Note that different manufacturers structure the menu options slightly differently to others. But the following sequence is probably very close, if not exact, for enabling debugging on most devices:

  1. Tap theSettings menu option or theSettings app on your phone/tablet.
  2. This next step will vary slightly for different versions of Android. TheDeveloper options menu is hidden away so as not to trouble regular users. You must perform a slightly odd task to unlock the menu option. Tap theAbout device orAbout Phone option. Find theBuild Number option and repeatedly tap it until you get a message informing you thatYou are now a developer!

    Tip

    Some manufacturers have different, obscure methods for achieving this step. If this step doesn't work, do a web search for your device and "unlocking developer options."

  3. Go back to theSettings menu.
  4. TapDeveloper options.
  5. Tap the checkbox forUSB Debugging.
  6. Connect your Android device to the USB port of your computer.
  7. Click the play icon from the Android Studio toolbar, as shown in the following screenshot:
    Running the app on a real device
  8. When prompted, click OK to run the app on your chosen device.

We arenow ready to learn some Kotlin and add our own Kotlin code to the Hello World project.

Frequently asked question

Q) So, Android isn't really an operating system; it is just a virtual machine and all Android phones and tablets are really Linux machines?

A) No, all the different subsystems of an Android device, which include Linux, the libraries, and the drivers, are what make up the Android operating system.

Summary

So far, we have set up an Android development environment, and created and deployed an app on both an emulator and a real device. If you still have unanswered questions (and you probably have more than at the start of the chapter), don't worry, because as we dig deeper into the world of Android and Kotlin, things will become clearer.

As the chapters progress, you will build a very rounded understanding of how everything fits together, and then success will just be a matter of practice and digging even deeper into the Android API.

In the next chapter, we will edit the UI using the visual designer and raw XML code, as well as writing our first Kotlin functions, and we will get to use some of the functions provided for us by the Android API.

Left arrow icon

Page1 of 11

Right arrow icon
Download code iconDownload Code

Key benefits

  • Start your Android programming career, or just have fun publishing apps on Google Play marketplace
  • The first-principle introduction to Kotlin through Android, to start building easy-to-use apps
  • Learn by example and build four real-world apps and dozens of mini-apps

Description

Android is the most popular mobile operating system in the world and Kotlin has been declared by Google as a first-class programming language to build Android apps. With the imminent arrival of the most anticipated Android update, Android 10 (Q), this book gets you started building apps compatible with the latest version of Android.It adopts a project-style approach, where we focus on teaching the fundamentals of Android app development and the essentials of Kotlin by building three real-world apps and more than a dozen mini-apps. The book begins by giving you a strong grasp of how Kotlin and Android work together before gradually moving onto exploring the various Android APIs for building stunning apps for Android with ease. You will learn to make your apps more presentable using different layouts. You will dive deep into Kotlin programming concepts such as variables, functions, data structures, Object-Oriented code, and how to connect your Kotlin code to the UI. You will learn to add multilingual text so that your app is accessible to millions of more potential users. You will learn how animation, graphics, and sound effects work and are implemented in your Android app.By the end of the book, you will have sound knowledge about significant Kotlin programming concepts and start building your own fully featured Android apps.

Who is this book for?

This book is for people who are new to Kotlin, Android and want to develop Android apps.It also acts as a refresher for those who have some experience in programming with Android and Kotlin.

What you will learn

  • Learn how Kotlin and Android work together
  • Build a graphical drawing app using Object-Oriented Programming (OOP) principles
  • Build beautiful, practical layouts using ScrollView, RecyclerView, NavigationView, ViewPager and CardView
  • Write Kotlin code to manage an apps data using different strategies including JSON and the built-in Android SQLite database
  • Add user interaction, data captures, sound, and animation to your apps
  • Implement dialog boxes to capture input from the user
  • Build a simple database app that sorts and stores the user s data

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date :Apr 30, 2019
Length:698 pages
Edition :1st
Language :English
ISBN-13 :9781789800883
Vendor :
Google
Category :
Languages :
Tools :

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Product Details

Publication date :Apr 30, 2019
Length:698 pages
Edition :1st
Language :English
ISBN-13 :9781789800883
Vendor :
Google
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99billed monthly
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconSimple pricing, no contract
€189.99billed annually
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick iconExclusive print discounts
€264.99billed in 18 months
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick iconExclusive print discounts

Frequently bought together


Learn Kotlin Programming
Learn Kotlin Programming
Read more
May 2019514 pages
eBook
eBook
€20.99€23.99
€29.99
Android Programming with Kotlin for Beginners
Android Programming with Kotlin for Beginners
Read more
Apr 2019698 pages
Full star icon3.7 (19)
eBook
eBook
€20.99€23.99
€29.99
Mastering Kotlin
Mastering Kotlin
Read more
Oct 2019434 pages
Full star icon2.7 (3)
eBook
eBook
€23.99€26.99
€32.99
Stars icon
Total92.97
Learn Kotlin Programming
€29.99
Android Programming with Kotlin for Beginners
€29.99
Mastering Kotlin
€32.99
Total92.97Stars icon

Table of Contents

30 Chapters
1. Getting Started with Android and KotlinChevron down iconChevron up icon
1. Getting Started with Android and Kotlin
Why use Kotlin and Android?
The beginner's first stumbling block
How Kotlin and Android work together
Setting up Android Studio
What makes an Android app?
The structure of Android's code
Our first Android app
Deploying the app so far
Frequently asked question
Summary
2. Kotlin, XML, and the UI DesignerChevron down iconChevron up icon
2. Kotlin, XML, and the UI Designer
Examining the log output
Exploring the project's Kotlin code and the main layout's XML code
Adding buttons to the main layout file
Leaving comments in our Kotlin code
Coding messages to the user and the developer
Writing our first Kotlin code
Frequently asked questions
Summary
3. Exploring Android Studio and the Project StructureChevron down iconChevron up icon
3. Exploring Android Studio and the Project Structure
A quick guided tour of Android Studio
Project Explorer and project anatomy
The Basic Activity project
Exploring the Android emulator
Summary
4. Getting Started with Layouts and Material DesignChevron down iconChevron up icon
4. Getting Started with Layouts and Material Design
Material design
Exploring Android UI design
Layouts
Creating the Exploring Layouts project
Building a menu with LinearLayout
Wiring up the UI with the Kotlin code (part 1)
Adding layouts within layouts
Making the layout look pretty
Wiring up the UI with the Kotlin code (part 2)
Building a precise UI with ConstraintLayout
Laying out data with TableLayout
Summary
5. Beautiful Layouts with CardView and ScrollViewChevron down iconChevron up icon
5. Beautiful Layouts with CardView and ScrollView
Attributes – a quick summary
Building a UI with CardView and ScrollView
Themes and material design
Creating a tablet emulator
Frequently asked question
Summary
6. The Android LifecycleChevron down iconChevron up icon
6. The Android Lifecycle
The life and times of an Android app
A simplified explanation of the Android lifecycle
How we handle the lifecycle phases
The lifecycle demo app
Some other overridden functions
The structure of Kotlin code – revisited
Summary
7. Kotlin Variables, Operators, and ExpressionsChevron down iconChevron up icon
7. Kotlin Variables, Operators, and Expressions
Learning the jargon
More on code comments
Variables
Operators and expressions
The express yourself demo app
Summary
8. Kotlin Decisions and LoopsChevron down iconChevron up icon
8. Kotlin Decisions and Loops
Making decisions in Kotlin
Repeating code with loops
while loops
do-while loops
Ranges
For loops
Controlling loops with break and continue
Sample code
Summary
9. Kotlin FunctionsChevron down iconChevron up icon
9. Kotlin Functions
Function basics and recap
Making functions flexible
Summary
10. Object-Oriented ProgrammingChevron down iconChevron up icon
10. Object-Oriented Programming
Introducing OOP
Basic classes
Visibility modifiers
Constructors
Basic classes app and using the init block
Introduction to references
Summary
11. Inheritance in KotlinChevron down iconChevron up icon
11. Inheritance in Kotlin
OOP and inheritance
Using inheritance with open classes
More polymorphism
Classes using the Inheritance example app
Summary
12. Connecting Our Kotlin to the UI and NullabilityChevron down iconChevron up icon
12. Connecting Our Kotlin to the UI and Nullability
All the Android UI elements are classes too
Kotlin interfaces
Using buttons and TextView widgets from our layout with a little help from interfaces
Nullability – val and var revisited
Summary
13. Bringing Android Widgets to LifeChevron down iconChevron up icon
13. Bringing Android Widgets to Life
Declaring and initializing the objects from the layout
Creating UI widgets from pure Kotlin without XML
Exploring the palette – part 1
Lambdas
Exploring the palette – part 2, and more lambdas
The widget exploration app
Coding the widget exploration app
Running the Widget Exploration app
Converting layouts to ConstraintLayout
Summary
14. Android Dialog WindowsChevron down iconChevron up icon
14. Android Dialog Windows
Dialog windows
The Note to self app
Summary
15. Handling Data and Generating Random NumbersChevron down iconChevron up icon
15. Handling Data and Generating Random Numbers
A random diversion
Handling large amounts of data with arrays
A simple mini-app array example
Getting dynamic with arrays
ArrayLists
Arrays and ArrayLists are polymorphic
Hashmaps
The Note to self app
Frequently asked questions
Summary
16. Adapters and RecyclersChevron down iconChevron up icon
16. Adapters and Recyclers
Inner classes
RecyclerView and RecyclerAdapter
Adding RecyclerView, RecyclerAdapter, and ArrayList to the Note to Self project
Running the app
Frequently asked questions
Summary
17. Data Persistence and SharingChevron down iconChevron up icon
17. Data Persistence and Sharing
The Android Intent class
Adding a settings page to Note to self
Persisting data with SharedPreferences
Reloading data with SharedPreferences
Making the Note to self settings persist
More advanced persistence
Backing up user data in Note to self
Frequently asked questions
Summary
18. LocalizationChevron down iconChevron up icon
18. Localization
Making the Note to self app Spanish, English, and German
Running Note to self in German or Spanish
Summary
19. Animations and InterpolationsChevron down iconChevron up icon
19. Animations and Interpolations
Animations in Android
Animations demo app – introducing SeekBar
Frequently asked questions
Summary
20. Drawing GraphicsChevron down iconChevron up icon
20. Drawing Graphics
Understanding the Canvas class
Using the Canvas class
The Canvas Demo app
The Android coordinate system
Creating bitmap graphics with the Bitmap class
Manipulating bitmaps
The Bitmap manipulation demo app
Frequently asked question
Summary
21. Threads and Starting the Live Drawing AppChevron down iconChevron up icon
21. Threads and Starting the Live Drawing App
Creating the Live Drawing project
Looking ahead at the Live Drawing app
Coding the MainActivity class
Coding the LiveDrawingView class
The game loop
Threads
Implementing the game loop with a thread
Running the app
Summary
22. Particle Systems and Handling Screen TouchesChevron down iconChevron up icon
22. Particle Systems and Handling Screen Touches
Adding custom buttons to the screen
Implementing a particle system effect
Handling touches
Running the app
Summary
23. Android Sound Effects and the Spinner WidgetChevron down iconChevron up icon
23. Android Sound Effects and the Spinner Widget
The SoundPool class
Sound demo app introducing the Spinner widget
Summary
24. Design Patterns, Multiple Layouts, and FragmentsChevron down iconChevron up icon
24. Design Patterns, Multiple Layouts, and Fragments
Introducing the model-view-controller pattern
Android design guidelines
Real-world apps
Device detection mini app
Configuration qualifiers
Fragments
Our first fragment app
Fragment reality check
Frequently asked question
Summary
25. Advanced UI with Paging and SwipingChevron down iconChevron up icon
25. Advanced UI with Paging and Swiping
The Angry Birds classic swipe menu
Building an image gallery/slider app
Kotlin companion objects
Building a Fragment Pager/slider app
Summary
26. Advanced UI with Navigation Drawer and FragmentChevron down iconChevron up icon
26. Advanced UI with Navigation Drawer and Fragment
Introducing the NavigationView
Examining the Age Database app
Starting the Age Database project
Exploring the auto-generated code and assets
Coding the Fragment classes and their layouts
Using the Fragment classes and their layouts
Summary
27. Android DatabasesChevron down iconChevron up icon
27. Android Databases
Database 101
The SQL syntax primer
The Android SQLite API
Coding the database class
Coding the Fragment classes to use the DataManager class
Running the Age Database app
Summary
28. A Quick Chat Before You GoChevron down iconChevron up icon
28. A Quick Chat Before You Go
Publishing
Making an app!
Carrying on learning
My other channels
Goodbye and thank you
A. Other Book You May EnjoyChevron down iconChevron up icon
A. Other Book You May Enjoy
Leave a review - let other readers know what you think
IndexChevron down iconChevron up icon
Index

Recommendations for you

Left arrow icon
.NET MAUI Cookbook
.NET MAUI Cookbook
Read more
Dec 2024384 pages
Full star icon4.3 (3)
eBook
eBook
€23.99€26.99
€33.99
iOS 18 Programming for Beginners
iOS 18 Programming for Beginners
Read more
Dec 2024584 pages
Full star icon4.4 (7)
eBook
eBook
€23.99€26.99
€33.99
Apps and Services with .NET 8
Apps and Services with .NET 8
Read more
Dec 2023798 pages
Full star icon4.8 (24)
eBook
eBook
€26.98€29.99
€37.99
Flutter Design Patterns and Best Practices
Flutter Design Patterns and Best Practices
Read more
Sep 2024362 pages
Full star icon4.3 (6)
eBook
eBook
€23.99€26.99
€33.99
Mastering iOS 18 Development
Mastering iOS 18 Development
Read more
Nov 2024418 pages
Full star icon5 (3)
eBook
eBook
€22.99€25.99
€31.99
Mastering Kotlin for Android 14
Mastering Kotlin for Android 14
Read more
Apr 2024370 pages
Full star icon5 (9)
eBook
eBook
€20.99€23.99
€29.99
Swift Cookbook
Swift Cookbook
Read more
Jun 2024422 pages
Full star icon5 (3)
eBook
eBook
€20.99€23.99
€29.99
Android Programming for Beginners
Android Programming for Beginners
Read more
Apr 2021742 pages
Full star icon4.2 (12)
eBook
eBook
€23.99€26.99
€32.99
How to Build Android Apps with Kotlin
How to Build Android Apps with Kotlin
Read more
May 2023704 pages
Full star icon4.4 (14)
eBook
eBook
€55.99€62.99
€77.99
Right arrow icon

Customer reviews

Top Reviews
Rating distribution
Full star iconFull star iconFull star iconHalf star iconEmpty star icon3.7
(19 Ratings)
5 star31.6%
4 star31.6%
3 star21.1%
2 star5.3%
1 star10.5%
Filter icon Filter
Top Reviews

Filter reviews by




N/AJan 25, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
very good book, i'm on chapter 4 now, keeps you motivating to go step by step
Feefo Verified reviewFeefo
Amazon CustomerFeb 04, 2021
Full star iconFull star iconFull star iconFull star iconFull star icon5
Nicely laid out and very informative. Easy to read and understand.
Amazon Verified reviewAmazon
Hurricane LakeJun 10, 2020
Full star iconFull star iconFull star iconFull star iconFull star icon5
This book is Great!. I am joyfully engaged in it. Your detailed explanations of the workings of Android Studio and how Android Studio works with Kotlin, i.e., how the UI and functions work, and what goes where and why is greatly appreciated. Thanks for taking the time to go that deep. Your book was such an education about the underlying workings of Android Studio and the workings of Android Studio using Kotlin that I am able to tweak all examples to work on the later Android Studio version - Android Studio 4. Thanks again.
Amazon Verified reviewAmazon
Michael O.Jul 12, 2019
Full star iconFull star iconFull star iconFull star iconFull star icon5
This should be the first book for fledgling developers of Android apps using Kotlin. I have read other books and had limited success in understanding key concepts. I liked Mr. Horton's conversational style and attention to detail. He purposefully doesn't burden the reader with more Kotlin language idioms than are needed for each current project. He explains concepts very well. He understands his core audience and gently addresses the limitations of beginning coders.
Amazon Verified reviewAmazon
GOBINDA R.Mar 18, 2021
Full star iconFull star iconFull star iconFull star iconFull star icon5
I brought this book as kindle addition. The book writer language is very easy to understand. And the content of the book is very helpful for me, as I just started to learn the code. This book is very useful also for beginners. It covers every topic in details. So, if you are searching for a cotlin programming book, then you must give this book a try, trust me.
Amazon Verified reviewAmazon
  • Arrow left icon Previous
  • 1
  • 2
  • 3
  • 4
  • Arrow right icon Next

People who bought this also bought

Left arrow icon
Apps and Services with .NET 7
Apps and Services with .NET 7
Read more
Nov 2022814 pages
Full star icon4.8 (27)
eBook
eBook
€26.98€29.99
€37.99
Apps and Services with .NET 8
Apps and Services with .NET 8
Read more
Dec 2023798 pages
Full star icon4.8 (24)
eBook
eBook
€26.98€29.99
€37.99
Machine Learning Techniques for Text
Machine Learning Techniques for Text
Read more
Oct 2022448 pages
Full star icon4.8 (6)
eBook
eBook
€25.99€28.99
€35.99
iOS 16 Programming for Beginners
iOS 16 Programming for Beginners
Read more
Nov 2022686 pages
Full star icon4.7 (50)
eBook
eBook
€23.99€26.99
€33.99
Test-Driven iOS Development with Swift
Test-Driven iOS Development with Swift
Read more
Apr 2022280 pages
Full star icon5 (3)
eBook
eBook
€17.99€20.99
€25.99
Right arrow icon

About the author

Profile icon John Horton
John Horton
John Horton is a programming and gaming enthusiast based in the UK. He has a passion for writing apps, games, books, and blog articles. He is the founder of Game Code School.
Read more
See other products by John Horton
Getfree 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 iconChevron 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 iconChevron 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 iconChevron 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 iconChevron 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 iconChevron 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 iconChevron 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.


[8]ページ先頭

©2009-2025 Movatter.jp