Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Building Android Applications for Beginners
Building Android Applications for Beginners
Building Android Applications for Beginners
Ebook178 pages2 hours

Building Android Applications for Beginners

Rating: 0 out of 5 stars

()

Read preview

About this ebook

This book is aimed at people with little or no understanding of developing applications or any experience with Java or computer programming in general.

Rather than immediately delving into details, the book focuses instead on constructing simple Android examples that can immediately be seen to work. As an example, some very simple but yet powerful graphics are developed, the image on the book's front cover is an example.

As the book progresses more skills are developed and the examples extended. Through this process, an understanding of programming, the Java language, the Android application architecture and the associated tools, is developed.

The book is ideal for both students and professionals. The only prerequisite is a PC/laptop and a desire to learn, not even a physical Android device is required.

LanguageEnglish
PublisherSteve Taylor
Release dateFeb 10, 2012
ISBN9781465905529
Building Android Applications for Beginners
Author

Steve Taylor

Steve Taylor is the founding pastor of Graceway Baptist Church (www.graceway.org.nz), in Ellerslie, New Zealand. He is completing a PhD on the emerging church and has a Masters in Theology in communicating the cross in a postmodern world. Steve receives requests to supply spirituality resources and to speak in UK and US.

Read more from Steve Taylor

Related to Building Android Applications for Beginners

Related ebooks

Programming For You

View More

Related articles

Reviews for Building Android Applications for Beginners

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Building Android Applications for Beginners - Steve Taylor

    Chapter 1 - Introduction

    1.1 Audience

    This book is intended for people with little or no knowledge of writing software. It will appeal to students and professionals wanting (or perhaps requiring) software experience and skills.

    Little more is assumed of the reader other than a secondary-school understanding of how to use a computer. There is not even a need to own an Android device, the Android emulator discussed in this book will run most of the examples with adequate performance.

    1.2 Aim of this book

    The overall aim of this book is to allow the reader to learn through the experience and pragmatism of building simple examples and applications that can be visibly seen to run on an Android device. The book is perhaps more of a practical build a working go-kart than a theoretical study of engineering (it is not intended as an investigation of software development techniques).

    As with tutoring in general, the knowledge gained in the early stages may be superseded by more detailed knowledge or sophistication later. Rather than trawling through the detailed operation of tools or the theory of programming languages, the student is instead encouraged to experiment with the examples and applications. The details of tools and programming are developed in small increments, as required. The applications that are developed become more complex as knowledge and skills are built.

    The skills developed through this book will however form a foundation for those wishing to progress further.

    1.3 Example Java Code

    Many of the examples in this book are either very short, or are built up gradually over perhaps a number of sections. In both cases manually typing the code into the editor (see later) is both easy and helpful for learning.

    Larger examples however are available from the following website -

    https://sites.google.com/site/stevebtaylortraining/

    Find the appropriate book and click on Example Java Code. Most are simply shown as plain text and can thus can be copied straight into the appropriate place in the editor, as described by each section in this book. Some may be sufficiently large that they are packaged in archive/zip files and require downloading and unpacking.

    An example of the sort of application that can be built, using the knowledge gained from this book, is shown below -

    This is a simple drawing application allowing shapes and colours to be selected and then drawn on the canvas. The Java source code for an example application similar to this can be found on the website and is discussed later in this book.

    Chapter 2 - Background on Android Devices

    Android is a software execution platform developed by the Open Source Community with support from Google. Android devices include phones (sometimes referred to as smart-phones) and tablets. These devices utilise touch displays and a limited number of physical buttons such as power on/off, audio volume, home, back, etc. Display sizes vary greatly from the smallest of phones through to tablets in excess of ten inches. Devices generally support automatic dynamic rotation and resizing of the display as the physical device is rotated. Storage is usually provided via internal solid state memory with most devices supporting external micro SD cards and tablets also supporting USB memory sticks. Network connectivity includes telephony cellular data on phones and Wi-Fi on many devices. Tablets often support an Ethernet connector. Other common integrated devices include camera (picture and video), microphone and GPS. Whilst intended for mobile use via the touch display, tablets usually support mice and keyboards with some having desktop docking stations.

    The core of the Android Operating System is based on a cut-down version of the popular Linux Operating System. Applications for Android are mainly written in the Java programming language using an Android specific User Interface. Hence to build applications for Android some understanding of both Java and the Android Java specifics needs to be developed.

    Chapter 3 - Conventions used in the book

    Double quotes are used in the book generally to either delineate multi-word terms or to indicate names, the latter are often from Java source code.

    The -> sequence (dash followed by a right angled-bracket) indicates a navigation in a tool, usually a series of mouse clicks are required. The starting point for the navigation is often the tool’s menu bar.

    Many programming languages, including Java, make extensive use of brackets (or braces) for various purposes, they each have multiple names, this book uses -

    () round brackets or parentheses

    [] square brackets

    {} curly brackets

    <> angle brackets

    Chapter 4 - Getting started

    The aim of this chapter is to quickly install the Android development tools and to create and run a very simple Android application. The development tools installed are used throughout this book.

    4.1 Setup Development Tools

    Android applications are generally not developed directly on Android platforms. Instead applications are typically developed on regular PCs (sometimes referred to as workstations, desk-sides or laptops) and then moved across to an Android device where they run (or execute). This style of development is sometimes referred to as cross platform development as the development is being done on a host platform (the PC) and the execution on a different target platform (the Android device).

    There are several software components that need to be installed to provide the infrastructure for Android application development. The installation of these is very straightforward.

    The most visible component that needs to be installed is an Integrated Development Environment (IDE). This provides facilities to configure the Android application, create graphical display layouts, edit Java Source Code, build the application, automatically transfer the application to an Android device or emulator and then run the application. Without an IDE a large number of tedious and error-prone steps would have to be implemented manually every time the application was changed.

    The IDE used in this book is Eclipse, combined with the Android Software Development Kit (SDK) and the Android Development Tools (ADT). The Android SDK and ADT provide extensions to Eclipse to support the Android platform including an Android device emulator.

    Eclipse is an Open Source IDE or platform controlled by the Eclipse Foundation, more information, including licensing can be found on the Eclipse website. The SDK and ADT are part of the Android Open Source Project (AOSP), led by Google, again more information, including licensing can be found on the Android Developer website.

    Eclipse requires a Java Development Kit (JDK) to be installed on the host platform in order for it to run. The JDK is owned by Oracle, again more information, including licensing can be found on the Java section of the Oracle Technology Network website.

    The following sections cover installation of the JDK, Eclipse, the SDK and the ADT. Ensure that licensing and system requirements are understood before proceeding.

    4.2 Step 1 – Install the Java JDK

    Download the latest Java Platform, Standard Edition (SE), Java Development Kit (JDK), a web search for Java SE downloads should readily locate this. Ensure that the correct version for your host Operating System, including whether 32 or 64 bit, is selected. It is the full JDK that is required, not just the JRE, (the JDK contains the JRE plus Java development tools). No demos, samples or SDK documentation downloads are required at this stage.

    Install the SE JDK as per the website instructions. It is advisable to use the default install locations, offered during the JDK install process, certain tools seem to sometimes have difficulty if other locations are used. During the JDK installation process, the Java Runtime Environment (JRE) also installs, again the recommendation is to use the default installation location.

    4.3 Step 2 – Install Eclipse

    Download the latest version of Eclipse, a web search for perhaps Eclipse downloads should readily locate the various Eclipse packages on the Eclipse website. The package Eclipse IDE for Java Developers is recommended for Android development. Ensure that the correct download for your host Operating System, including whether 32 or 64 bit, is selected.

    Since Eclipse is itself a Java application there is little to be done regarding installation. Unzip the downloaded Eclipse archive file to a location of your choosing. Within the top level directory of this unzipped archive, run the setup.exe file by double clicking on it. You may wish to create a shortcut to this Eclipse file.

    Once running, Eclipse suggests a default directory for the application project files called a workspace. Use the suggested directory unless you specifically want it elsewhere, you probably also want to select it as the default to prevent the question being asked again on every restart of Eclipse. Make a note of the location chosen, it is needed later. After a few seconds the Eclipse welcome window appears.

    4.4 Step 3 – Install Android SDK and ADT

    Within the IDE (Eclipse) select Help -> Install New Software. Click on the Add button, a new window pops-up, in the Name field enter Android, in the Location field enter -

    https://dl-ssl.google.com/android/eclipse/

    then click OK. A pending message appears, after a few tens of seconds it is replaced with Developer Tools, tick the box next to this and then click Next. You may need to read and accept licenses etc as requested. The first stage of the Android tools for the IDE downloads and installs. When prompted restart the IDE.

    Upon restart of the IDE a Welcome to Android Development window appears, tick Install new SDK then deselect Install the latest available version of Android APIs ... and instead select Install Android 2.1 .... You may also wish to change the default installation location. Now click Next, you may need to decide whether to allow the sending of usage information. After a few

    Enjoying the preview?
    Page 1 of 1