• No results found

5. Conceptual design of Android programming exercises

5.4. Content of the exercises

The following section will give an overview of the content, objectives and task of each tutorial designed by the author. They have been created and implemented by the author based on available online documentation from Google and different guide books for Android programming. The summaries given are just a short description to give the reader a general idea of the exercises.

Aside from the ECLASS model, the general idea of the structure and content of the tutorials was determined by what is necessary to build a simple application and to how to get an appropriate entry into the field of programming for Android. Starting with a simple 'Hello World' application gives a suitable introduction and with this first code example basics of the framework to work with Android can be explained including the installation and handling of needed software tools as well as the project structure and file system. Subsequently, becoming familiar with different layouts for applications was considered to be a reasonable follow-up to the first exercise as this topic is still relevant to the project structure part of the first exercise. The XML code is easy to understand and the layouts can be modified and understood with the given information. In the third exercise, the main focus is on the principle of Intents as connectors between Activities which was chosen as it is one of the main characteristics and functionalities of Android programming. The focus of the fourth exercise is on database access to manage data in order to introduce data storage with SQLite databases in Android. Finally, in the fifth exercise the connection to the cartographic focus is made with an introduction of using a map service provided by Google Maps in combination with obtaining the user location from the device. This should deliver a deeper practical insight into the field of location based services and the involved technological aspect. The following sections will give an overview of the specific content and objectives of each exercise.

5.4.1. Content of the single exercises

Exercise 1 – Building your first Android application

The first exercise gives an overview of the first steps in software development for the Android platform. The programming tools (Android SDK, Eclipse) are introduced and a short overview of the basic elements of an Android project in general and in the Eclipse IDE is given. In a tutorial, the setup of the Android SDK, Eclipse and the ADT-Plugin is explained, before an example of a 'Hello World' application is given and discussed. Additionally, configuring and launching an emulator for

an Virtual Android Device is explained. As an easy first task, the code of the 'Hello World' example had to be adapted to the Android framework with referencing to an external layout definition in an XML file.

The objective of this exercise is to enable the students to install and set up the Android Software Development Kit and the Eclipse IDE with the ADT-Plugin for Android. Additionally, they are aware of an Android project's structure and can implement a simple Activity with a 'HelloWorld' application.

Exercise 2 - Common layout objects

In this exercise three common layout types of Android applications are introduced and explained.

The idea of separating the layout from the code is recapitulated in the introduction and it is explained how to define a layout with XML code and attributes. In the following three tutorials, the layout types LinearLayout, RelativeLayout and ListView are explained and a sample code for each type is provided. Figures demonstrate the result of the code in the Graphical Layout view in Eclipse.

The task of this exercise is to slightly change the layouts with the knowledge from the provided code and layout descriptions to add more View elements. Furthermore, text strings and other resources had to be defined in separate XML files.

In this exercise the objective is to enable the students to implement three basic types of user interface layouts which are LinearLayout, RelativeLayout and ListView. They should understand the general idea of the separation of application code and application layout in the Android framework.

Exercise 3 - Building an intent to start another Activity

In this exercise, the principle of interaction between Activity classes with an Intent is introduced.

The characteristics and properties of an Intent are explained as well as the data it can deliver.

The tutorial focuses on delivering an Intent that has been started by clicking a button from an Activity to another. The Intent passes on an text string that is displayed in the new Activity class.

Additionally, a Button in the options menu has to be added which launches the same Intent. As a task, a new button had to be implemented in the new Activity class to simulate the navigation back to the Activity started initially. The text string has to be passed back with this Intent as well.

As the objective of this exercise, the students should understand the basic idea of application interaction using Intents. They are able to implement a simple interface with a button to pass data from an Activity's text field to another Activity. Furthermore they become more familiar with the Android-manifest and the use of Intent-filters.

Exercise 4 - Access to SQLite databases

In this exercise, the basic principles of the SQLite relational database management system are introduced. Important characteristics are listed up and the SQLite own syntax is explained with a focus on the query() method. The tutorial consists of two parts. Firstly, it is described how a database is accessed and handled by a managing class. In the second part, it is explained how to display the data in a ListView layout. As a task, an update method for the database had to be implemented and additionally a delete method could be added as well.

The objective of this exercise is to make the students familiar with the SQLite relational database management system and enable them to implement the basic CRUD (create, read, update, delete) database operations. These operations are used to display contents of the database in a ListView layout.

Exercise 5 – Google Maps API and user location

In this exercise, the Google Maps API for Android is introduced. The MapView and MapActivity classes to create a Map interface and the LocationManager to obtain the user location are described and explained. In the tutorial, it is described how to obtain get a Google Maps API Key to integrate the Google Maps API in an Android application. Subsequently, a simple application implementing a MapView layout and obtaining the user location from a MyLocationOverlay is demonstrated. With this exercise being quite complex and as a modification to the code would require a lot more explanation in the tutorial part, a task is left out to keep the exercise manageable.

In this last exercise, the objective is to enable students to implement a map provided by Google Maps in an Android application. They should be familiar with the Google Maps API functionality and can obtain the user location from the Android system as well as displaying it in a map created with the API.

5.4.2. Outlook to ideas for further exercises

The exercises described already cover a wide range of basic operations that can be implemented in a Android application. Despite a Java programming background, the author had to get familiar to the characteristics of Android programming at the first place which did not allow him to spend more time on the exercises in order to finish the thesis in time. Possible topics of further exercises could include the life cycle of an Activity and the integration of non-proprietary map content like OSM into an application as well as access to other sensors like motion sensors that are important for AR applications and the design and creation of custom made icons and images for an own application and their integration into a project.

Related documents