Useful tools for an effcient development of an Android App - The Android SDK

Size: px
Start display at page:

Download "Useful tools for an effcient development of an Android App - The Android SDK"

Transcription

1 RWTH Aachen University Chair of Data Management and Data Exploration Prof. Dr. T. Seidl Proseminar Useful tools for an effcient development of an Android App - The Android SDK Marco Moscher June 2012 Supervision: Dipl.-Ing. Marwan Hassani

2 Declaration of Originality The material in this paper has not previously been submitted for a degree in any University, and to the best of my knowledge contains no material previously published or written by another person except where due to acknowledgement is made in the paper itself. Aachen, June 26, 2012

3 Contents List of Figures 3 Abstract 5 1 Introduction to Android What is Android? The Android SDK Using the Android SDK Explaining the fundamental principles Design a layout Collaborate layout and functionallity Debugging an App using SDK features DDMS in chorus with LogCat Advantages of the Android SDK features 20 Bibliography 21 A Appendix 22 A.1 Behind the scenes (Dalvik VM) B List of Abbreviations 24 C Source code listings 26 C.1 Java source code C.2 XML (layout) source code

4 List of Figures 1.1 Global market share of different mobile OS ContactAndCameraExplorer screen shots SDK-Manager [8] GUI-Designer compared to XML-Editor startactivity() Intent-Object transmitting diagram startactivityforresult() Intent-Object transmitting diagram The Eclipse standard debug perspective The Eclipse DDMS perspective LogCat-View in Eclipse A.1 Android component stack [9]

5 Abstract The following article will introduce the Android-SDK for developing Apps for the Android-OS. It will shortly mention the Android-OS, describe how to integrate the SDK in the development environment and mainly focus on the features included by the ADT-Plugin for Eclipse. Especially it will give an introduction in using the Designer and Debugger. For example it will be illustrate how to use the LogCat-Class in chourse with the Debugger for gathering information about a running App. Furthermore the collaboration between layout and functionality will be explained shortly and a introduction in the fundamental programming principles for Android with using Java is given. 5

6 Chapter 1 Introduction to Android 1.1 What is Android? Android is an operating system (OS) for mobile and hand-held systems. The Android OS was founded in the year 2003 by Andy Rubin and acquired by Google in Until now the OS is developed by the Open Handset Alliance - with Google acting as the main driver [2]. The Android OS is based on the open-source Linux-Kernel and implemented in Java, so everybody is able to contribute to its future. As being licensed under GNU GPLv2 [2] Android SDK is free of charge. Figure 1.1: Global market share of different mobile OS As seen in Figure 1.1 today Android is the leading OS on global mobile device market with 56,1% followed by Apple with the iphone-os reaching 6

7 1.1. What is Android? 7 22,6% [4]. For that reason Apps for the Android OS could reach about 100% more users in contrast to an iphone App[1].

8 Chapter 2 The Android SDK The Android SDK will be introduced and demonstrated by two tools coming with it: - Graphical-User-Interface (GUI) Designer - Dalvik-Debug-Monitor-Server (DDMS) These tools along with other important features for implementing, designing and debugging an App, such as Activities, Intents, the ADB, Emulator and LogCat will be explained using the example of a simple App called ContactAndCamera- Explorer. Figure 2.1: ContactAndCameraExplorer screen shots As shown in the figure 2.1 the App is divided in four different App regions, called Activities. On its right the App shows the possibility of accessing the contacts and with tapping on an entry, the option to edit e.g., Names and Adresses. On the left it communicates with the built-in camera and handles the bitmap-data, committed by the camera itself, of a taken photo for displaying it as a thumbnail. 8

9 2.1. Using the Android SDK Using the Android SDK In order to enable users to participate with the SDK, which includes all API (Application-Programming-Interface) for the currently known Android-Platform versions (1.1 up to 4.0.x) and platform specified compiling/linking tools, Google rolls out the Android SDK Manager. This Manager (Figure 2.2) makes it possible to install and manage the necessary tools in a simple way. Furthermore a Java- Figure 2.2: SDK-Manager [8] Development-Kit (JDK) and maybe an Integrated-Development-Environment (IDE) are needed. Over the course of this article I will use the Eclipse IDE with the Android Development Tools - Plugin (ADT) designed by Google, especially for Eclipse [5]. This plugin extends the capabilities of the IDE by providing a designer to create a GUI and a debugger to debug an App within the IDE, e.g. by using the DDMS perspective.

10 2.2. Explaining the fundamental principles Explaining the fundamental principles A typical Android App consists of classes and layouts using each other. Classes are used to implement the program logic, and create the App basic functionality. These classes use the layout to display information on the screen and to react on user interactions. Usually every class implements one layout, e.g. the ContactAndCameraExplorer consists of four class files, where each one uses a different layout file. In this case a class is called Activity. For that reason Activity often means the collaboration between a class (extending the Activity class) and a layout file. Utilizing the SDK in chorus with the ADT plugin a developer does not have to take care of compiling and linking the created layouts. The SDK-Tool aapt (Android-Asset-Packing-Tool) will automatically create the needed Java code of the layout files and merge them into one class called R. For using a layout inside a class file the R class has to be imported in the header, as shown in listing 2.1, line 3. Listing 2.1: improting the R class - MainActivity.java (l. 1-3) 1 package mm.dev. contact ; 2 3 import mm.dev. contact.r; As a consequence a layout file is only used to describe the GUI and is written in the Extensible-Markup-Language (XML), listing Design a layout As mentioned before the GUI is described with XML which uses different tagnames to identify the type of an element and a couple of predefined attributes, beginning with the prefix android:, to set the different styles. These attributes are nearly the same as the ones used in Cascading Style Sheets (CSS) for styling a HTML-Site. Listing 2.2: Contact-Example Button - main.xml (l. 8-18) 1 < Button 2 android:id ="@+id/ contactbutton " 3 android: layout_ width =" wrap_ content " 4 android:layout_height =" wrap_content " 5 android:layout_marginbottom ="40 dip " 6 android: onclick =" onchoose " 7 android:text / bt_init_contact " 8 android:textsize ="14 pt" 9 android:padding ="10 dip "

11 2.2. Explaining the fundamental principles android:background =" # ED" 11 /> Listing 2.2 is an extract of the initial Activity layout and indicates the Contact- Exmaple -Button (compare Figure 2.1). This GUI element receives an ID contactbutton, to access its information in the further program logic. Additionally e.g., a background color, a padding and an event handler (onchoose() method) for the onclick-event are described. Futhermore the SDK provides others input events such as onlongclick(), on- FocusChange() and more [7]. As demonstrated in Listing 2.2 there is the possibility to create all App layouts directly in XML (Figure 2.3, right side). Even more it is practicable in another, easier, way by using the GUI-Designer with its What-You-See-Is-What-You-Get (WYSIWYG) Editor (Figure 2.3, left side). Sometimes it can be useful comparing both methods. First drag and drop all needed elements into the layout grid with the GUI-Designer and then finally define its detailed styles in the XML file. Therefore a switch between the designer and the texteditor is always possible. Figure 2.3: GUI-Designer compared to XML-Editor To obtain functionality and interactions within the GUI, the next part presents how to set a layout as the currently window design and how to interact with the mentioned events.

12 2.2. Explaining the fundamental principles Collaborate layout and functionallity As mentioned before a class file has the ability to access a layout by importing the R-class (cf. Section 2). This class includes all defined ID s, strings, arrays and other values created within the layout, separated by its category type. R.id.button_contact (category type "id") R.layout.main (category type "layout") Each class that extends the Activity class, can easily set its GUI by using the function setcontentview(), passing the layout as parameter by using the R class. Normally this function is placed in the oncreate() method and initiates the layout, as shown in Listing 2.3. Listing 2.3: setcontentview() - MainActivity.java (l ) 1 protected void oncreate ( Bundle savedinstancestate ) { setcontentview ( R. layout. main ); 5 } To interact and switch between different GUI s which is often associated with user interaction - such as a button onclick-event - the Activity class implements methods like startactivity() and startactivityforresult(). These methods are both initializing another Activity class. public class MainActivity extends Activity { public void onchoose( final View button ) { startacivity( new Intent( this, ContactExplorerActivity.class ) );.. }... } public class ContactExplorerActivity extends ListActivity {... public void oncreate( Bundle savedinstancestate ) { }... } Figure 2.4: startactivity() Intent-Object transmitting diagram Figure 2.4 shows the onchoose() method onclick-event for both buttons in the mainlayout (compare Listing 2.2) - calling the startactivity() method for initializing a new class (ContactExplorerActivity) and furthermore another GUI.

13 2.2. Explaining the fundamental principles 13 Both - startactivity() and startactivityforresult() - methods need an Intent- Object as parameter, so that every Activity is aware of its parent class and intention of call (Intent). Therewith and by adding parameters to the Intent-Object, the framework offers the possibility to transfer information between different classes. Listing 2.4: setting Intent parameters - ContactExplorerActivity.java (l ) 1 Intent contactinformations = new Intent ( this, ContactInformationActivity. class ); 2 contactinformations. putextra (" referenceid ", position ); 3 contactinformations. putextra (" vorname ", forename ); 4 contactinformations. putextra (" nachname ", surname ); 5 6 this. startactivityforresult ( contactinformations, EDIT_CONTACT_CALL ); The transmitted Intent-Object in Listing 2.4 which communicates between the ContactExplorerActivity and ContactInformationActivity classes includes three parameters, two string-values (vorname, nachname) and an integer-value (referenceid), to transfer needed information. Accessing these parameters in the child class (ContactInformationActivity) is very easy, as shown in Listing 2.5. Listing 2.5: accessing intent parameters - ContactInformationActivity.java (l ) 1 protected void oncreate ( Bundle savedinstancestate ) { // reading data committed by partent activty - through the intent. 5 final Bundle data = getintent (). getextras (); 6 7 this. referenceid = data. getint (" referenceid "); } In case an Activity class is called with startactivityforresult() - compare figure the affected class has to signal finishing its work flow by calling the finish() method to commit the result intent. Previously, it has to create this intent object, setting its values like in Listing 2.4, and combine this with a result-status-code in the setresult() method. So furthermore the child class can signal its parent class which type of result is transmitted, by setting a significant result-status-code. Thereby the parent class has the ability to interact in a conform way with the result values. To ensure that all these information get transmitted, to indicate the point of loosing information or to eliminate mistakes, the SDK combined with the ADT

14 2.2. Explaining the fundamental principles 14 public class ContactExplorerActivity extends ListActivity { protected void onlistitemclick( ListView l, View v, int position, long id) {... Intent contactinformations = new Intent(...); this.startactivityforresult( contactinformations, EDIT CONTACT CALL); } protected void onactivityresult(int requestcode, int resultcode, Intent data) {... if( requestcode == EDIT CONTACT CALL ){ if( resultcode == Activity.RESULT OK ) { //save new contact data, transmitted by data }else{.. } } }... } public class ContactExplorerActivity extends ListActivity {... public void oncreate( Bundle savedinstancestate ) { } public void saveandclose( final View view ) {... Intent changes = new Intent(); //putting data to the result intent changes.putextra( referenceid, this.referenceid);... setresult(result OK, changes); finish(); }... } Figure 2.5: startactivityforresult() Intent-Object transmitting diagram plugin for Eclipse brings tools for debugging an App and logging information.

15 2.3. Debugging an App using SDK features Debugging an App using SDK features The SDK offers two different types of options for debugging and observing a running App to the developer. Firstly the direct debugging on a mobile device running the Android-OS and secondly the Emulator for executing an App in an emulated OS using a desktop PC. For using a real device the USB debugging option (Settings Developer options USB debugging) and the privilege to install unsigned Apps (Settings Security Unknown sources) are necessary. Otherwise to use an emulator for simulating a running device a Android- Virtual-Device (AVD) image is needed. This image can be created with AVD- Manager (Windows AVD Manager), which comes simultaneously with the SDK-Manager (cf. Section 2.1). For debugging an App within the emulator the correct AVD has to be selected in the options dialog (Run Debug Configurations.. Targets Deployment Target Selection Mode Automatic). By default, if a mobile device is connected, the IDE will use this external device. With clicking on the Bug-Button in the IDE bar the debugger will start its routine. The App gets compiled, transferred and installed on the Android device automatically. At the same time the ADB connects to the debugging server running on the device and supplies information, e.g the log trace (cf. Section 2.3.1). By default Eclipse offers a Debug perspective (Figure 2.6) for the standard debugging options. (Window Open Perspective Debug)

16 2.3. Debugging an App using SDK features 16 Figure 2.6: The Eclipse standard debug perspective

17 2.3. Debugging an App using SDK features DDMS in chorus with LogCat An even more complex debugging perspective is the DDMS, Figure 2.7. It offers some more features than the debug perspective that typically comes with Eclipse. In addition it is possible to capture screen shots, gather heap or stack information, to emulate incoming calls, SMS and to fake the current geographic position (GPS). Figure 2.7: The Eclipse DDMS perspective In chorus with the DDMS it is handy to use the SDK Log class. The Log class offers the possibility to throw an error/warning combined with a message out of the running App. These can be separated by different error-levels verbose

18 2.3. Debugging an App using SDK features 18 (lowest priority) up to silent (highest) by using the right methods. In Figure 2.8 the App throws 18 errors at debug (d()-methode d = debug) and with warning level. The LogCat tool now dumps all thrown errors into a log trace which can be recovered via the LogCat-View (Windows Show View LogCat) docked into the DDMS perspective. Figure 2.8: LogCat-View in Eclipse In the example App the Log class is used to observe either entering or leaving a method and even more it logs values getting transmitted between different activities using the Intent-Object, compare the shown Listings below. Listing 2.6: logging method calls - MainActivity.java (l ) 1 protected void oncreate ( Bundle savedinstancestate ) { 2 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering oncreate ()"); } Listing 2.7: logging transmitted values - CameraActivty.java (l.37-54) 1 requestcode, int resultcode, Intent data ) { Log. d( MainActivity. MM_ INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onactivityresult ()"); 2 Log.d( MainActivity. MM_INFORMATION, " requestcode : "+ requestcode + ", resultcode : " + resultcode + " "); }

19 2.3. Debugging an App using SDK features 19 Listing 2.8: throw warings - ContactExplorerActivity.java (l ) 1 protected void onlistitemclick ( ListView l, View v, int position, long id) { if( names. length >= 2 ) { } else { 6 Log.w( MainActivity. MM_WARNING, this. getclass (). getsimplename () + ": " + " Current contact [ "+ item + " ] has no surname, splitting and accessing the array would cause an Error! "); 7 } 8 9 }

20 Chapter 3 Advantages of the Android SDK features In conclusion the Android SDK is a very powerful conjunction of tools and functions for inventing and writing Android Apps. Beginning with a simple installation using the SDK-Manger (cf. Section 2.1) along with many new perspectives and functions coming with the ADT plugin in Eclipse (cf. Section 2.2) until at least the debugging suite (cf. Section 2.3), the SDK supplies many features for a better work flow. For example the programmer does not have to manage and organize the assets or the project internal linking of files. Furthermore it offers many ready-to-run Sample-Projects (File New Project Android Android Sample Project) to become acquainted with SDK and Framework. So even for the first basic program you do not have to have any knowledge about programming Java code or knowing the Android basics - easily create it and Try & Error the App. If you are not interested in developing in an IDE, Android also bids the option to use the command-line tools which are even more inefficient [6]. At least it should be mentioned that all features include by the Android SDK and even the Eclipse IDE are open-source tools and free of any charge. This is the, in my opinion, a major point for using Android. In contrast to the famous iphone there is no need for any budget to invent an App for Android. If you are even interested in developing an iphone OS App you need to have a Mac-Book, the X-Code IDE, and for sharing your App a developer-license for 99$ a year [1]. So as a result the Android SDK is a powerful development kit for costless and efficient developing Apps for the Android OS offered by Google. 20

21 Bibliography [1] Apple. Mac developer Program. May [2] W. Article. Android (operating system). May [3] A. Becker. Android 2 Grundlagen und Programmierung. dpunkt-verl, Heidelberg, [4] Gartner. Gartner Says Worldwide Sales of Mobile Phones Declined 2 Percent in First Quarter of 2012; Previous Year-over-Year Decline Occurred in Second Quarter of May [5] Google. ADT Plugin for Eclipse, Android Developers. May [6] Google. Building and Running from the Command Line. May [7] Google. Input Events. May [8] Google. sdk manager packages.png PNG-Grafik. May Direct link: packages.png. [9] Google. system-architecture.jpg JPEG-Grafik. May Direct link: system-architecture.jpg. [10] Google. Using DDMS, Android Developers. May [11] Google. What is Android?, Android Developers. May

22 Appendix A Appendix A.1 Behind the scenes (Dalvik VM) As already mentioned before in the article the Android OS uses the Linux-Kernel as the base competent of its OS in the component stack. (cf. Section 1) Figure A.1: Android component stack [9] Building up on this Linux-Kernel, which acts as an abstraction layer between 22

23 A.1. Behind the scenes (Dalvik VM) 23 the hardware and the rest of the software stack, there will be the Linux typically libraries and the Android-Runtime layer. The Android-Runtime layer implements the Dalvik Virtual Machine, which is used to execute and observed every Android App in the Android-OS. The Dalvik Virtual Machine (DVM) was especially developed and customized for the Android OS to replace the standard Java Virtual Machine - which is used to execute the Java bytecode of an Java application with a better VM bringing more performance and resource-efficiency on devices with low-memory and relatively slow microprocessors. In case of this performance increase, every App on the Android OS gets granted a single DVM-Instance. This increases the security enormously, because no App can access the registers/ram allocated to an other running App which prevents memory injections. Futhermore theandroid-runtime layer is followed by the Application Framework and Application Layer so that every Android App which is executed in the Dalvik VM (Runtime Layer) has the ability to access the core methods of the Application Framework. This Application Framework offers the ability to use standard methods, e.g. the Window-Manager, Location-Manager or Telephony-Manger. The ability to access these features in a programmatic simple way is provided by the Android Software Development Kit, which was explained in the article.

24 Appendix B List of Abbreviations ADB Android-Debug-Bridge ADT Android Development Tools AVD Android-Virtual-Device API Application-Programming-Iterface CSS Cascading-Style-Sheets DDMS Davlik-Debug-Monitor-Server DVM Dalvik-Virtual-Machine GNU GPL GNU general public license GUI Graphical-User-Iintrace GPS global positioning system HTML hypertext markup language ID identifier IDE integrated development environment JDK java development kit OS operating system SDK Software-Development-Kit SMS short message service USB universal serial bus 24

25 APPENDIX B. LIST OF ABBREVIATIONS 25 VM virtual machine WYSIWYG What-You-See-Is-What-You-Get XML Extensible-Markup-Language

26 Appendix C Source code listings C.1 Java source code Listing C.1: MainActivity.java 1 package mm.dev. contact ; 2 3 import mm.dev. contact.r; 4 import android. app. Activity ; 5 import android. content. Intent ; 6 import android.os. Bundle ; 7 import android. util. Log ; 8 import android. view. View ; 9 import android. view. Window ; public class MainActivity extends Activity { /* Debbuging TAGS */ 14 public static final String MM_ WARNING = " mm. dev. WARNINGS "; 15 public static final String MM_ INFORMATION = " mm. dev. INFORMATION "; Override 19 protected void oncreate ( Bundle savedinstancestate ) { 20 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering oncreate ()"); 21 super. oncreate ( savedinstancestate ); 22 // remove Widget - Titlebar 23 this. requestwindowfeature ( Window. FEATURE_ NO_ TITLE ); 24 setcontentview ( R. layout. main ); 25 } public void onchoose ( final View button ) { 26

27 C.1. Java source code Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onchoose ()"); // switching between both possible buttons. 31 switch ( button. getid () ) { 32 case R.id. contactbutton : 33 // launche the contact - explorer activity 34 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Starting ContactExplorerActivity "); 35 startactivity ( new Intent ( this, ContactExplorerActivity. class ) ); 36 break ; case R.id. camerabutton : 39 // launche the camera activity 40 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Starting CameraActivity "); 41 startactivity ( new Intent ( this, CameraActivity. class ) ); 42 break ; default : 45 Log.w( MainActivity. MM_WARNING, this. getclass (). getsimplename () + ": " + " undefind Button - ID [ " + button. getid () + " ] was committed!"); 46 break ; 47 } } }

28 C.1. Java source code 28 Listing C.2: CameraActivity.java 1 package mm.dev. contact ; 2 3 import mm.dev. contact.r; 4 import android. app. Activity ; 5 import android. content. Intent ; 6 import android. graphics. Bitmap ; 7 import android.os. Bundle ; 8 import android. util. Log ; 9 import android. view. View ; 10 import android. view. Window ; 11 import android. widget. ImageView ; 12 import android. widget. TextView ; 13 import android. widget. Toast ; public class CameraActivity extends Activity { private static final int CAMERA_ ACTIVITY_ CALL = 1911; 18 Override 20 protected void oncreate ( Bundle savedinstancestate ) { 21 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering oncreate ()"); 22 // TODO Auto - generated method stub 23 super. oncreate ( savedinstancestate ); 24 // remove Widget - Titlebar 25 this. requestwindowfeature ( Window. FEATURE_ NO_ TITLE ); 26 setcontentview (R. layout. camera_view ); 27 } public void takepicture ( final View view ) { 30 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering takepicture ()"); 31 Intent cameraresponseintent = new Intent ( android. provider. MediaStore. ACTION_IMAGE_CAPTURE ); 32 startactivityforresult ( cameraresponseintent, CAMERA_ ACTIVITY_ CALL ); } 35 Override 37 protected void onactivityresult ( int requestcode, int resultcode, Intent data ) { 38 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onactivityresult () "); 39 Log.d( MainActivity. MM_INFORMATION, " requestcode : "+ requestcode + ", resultcode : " + resultcode + " ");

29 C.1. Java source code if( requestcode == CAMERA_ ACTIVITY_ CALL ){ 42 if( resultcode == Activity. RESULT_ OK ) { 43 // get the transmitted bitmap data and load it into the image view 44 Bitmap createdimage = ( Bitmap ) data. getextras (). get (" data "); 45 ImageView activityimageview = ( ImageView ) findviewbyid (R.id. cameraimage ); 46 activityimageview. setimagebitmap ( createdimage ); 47 TextView label = ( TextView ) findviewbyid ( R. id. pictureheadline ); 48 label. settext ( R. string. tx_taken_picture ); 49 } else { 50 Log.w( MainActivity. MM_WARNING, this. getclass (). getsimplename () + ": " + " Unkown resultcode [ " + resultcode + " ] no Operation defined."); 51 Toast. maketext ( this, " Please take an new picture!", Toast. LENGTH_LONG ). show (); 52 } 53 } 54 } 55 }

30 C.1. Java source code 30 Listing C.3: ContactExplorerActivity.java 1 package mm.dev. contact ; 2 3 import java. util. ArrayList ; 4 import mm.dev. contact.r; 5 import android. app. Activity ; 6 import android. app. ListActivity ; 7 import android. content. ContentResolver ; 8 import android. content. Intent ; 9 import android. database. Cursor ; 10 import android. os. Bundle ; 11 import android. provider. ContactsContract ; 12 import android. util. Log ; 13 import android. view. View ; 14 import android. view. Window ; 15 import android. widget. ArrayAdapter ; 16 import android. widget. ListView ; 17 import android. widget. Toast ; public class ContactExplorerActivity extends ListActivity { private static final int EDIT_ CONTACT_ CALL = 2511; 22 private ArrayAdapter < String > contactadapter = null ; /** Called when the activity is first created. */ Override 26 public void oncreate ( Bundle savedinstancestate ) { 27 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering oncreate ()"); 28 super. oncreate ( savedinstancestate ); 29 // remove Widget - Titlebar 30 this. requestwindowfeature ( Window. FEATURE_ NO_ TITLE ); setcontentview (R. layout. contact_overview ); ArrayList < String > mycontacts = new ArrayList < String >() ; // Accessing the contacts and save them into the mycontacts - ArryList 37 ContentResolver cr = getcontentresolver (); 38 Cursor zeiger = cr. query ( ContactsContract. Contacts. CONTENT_URI, null, null, null, null ); if( zeiger. getcount () > 0 ) { 41 while ( zeiger. movetonext ()){ 42 String contactname = zeiger. getstring ( zeiger. getcolumnindex ( ContactsContract. Contacts.

31 C.1. Java source code 31 DISPLAY_NAME ) ); 43 if( contactname!= null &&! mycontacts. contains ( contactname )) { 44 mycontacts. add ( contactname ); 45 } 46 } 47 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Conacts successfull read "); 48 } contactadapter = new ArrayAdapter < String >( this, 51 android.r. layout. simple_ list_ item_ 1, 52 mycontacts 53 ); 54 // sorting the contacts 55 contactadapter. sort ( null ); 56 // Connect the ListeView - View to the Adapter 57 setlistadapter ( contactadapter ); 58 } 59 Override 61 protected void onlistitemclick ( ListView l, View v, int position, long id) { 62 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onlistitemclick ()"); String item = ( String ) getlistadapter (). getitem ( position ); String [] names = item. split (" "); 67 String forename = names [ 0]; 68 String surname = ""; if( names. length >= 2 ) { 71 if( names. length > 2) for ( int i = 1; i < names. length ; i++ ) { 72 surname += names [i]; 73 if( i < names. length -1 ) surname += " "; 74 } 75 else surname = names [ 1]; 76 } else { 77 Log.w( MainActivity. MM_WARNING, this. getclass (). getsimplename () + ": " + " Current contact [ "+ item + " ] has no surname, splitting and accessing the array would cause an Error! "); 78 }

32 C.1. Java source code Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Starting ContactInformationActivity and commit contact information within the Intent "); Intent contactinformations = new Intent ( this, ContactInformationActivity. class ); 85 contactinformations. putextra (" referenceid ", position ); 86 contactinformations. putextra (" vorname ", forename ); 87 contactinformations. putextra (" nachname ", surname ); this. startactivityforresult ( contactinformations, EDIT_CONTACT_CALL ); } 94 Override 96 protected void onactivityresult ( int requestcode, int resultcode, Intent data ) { 97 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onactivityresult ()"); 98 Log. d( MainActivity. MM_ INFORMATION, " requestcode : " + requestcode + ", resultcode : " + resultcode + " "); if( requestcode == EDIT_ CONTACT_ CALL ) { 101 // Contact was edited 102 if( resultcode == Activity. RESULT_ OK ) { 103 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Activity. RESULT_ OK - > saving changes "); 104 // prepare new name 105 String name = data. getstringextra (" vorname ") + " " + data. getstringextra (" nachname "); 106 int pos = data. getintextra (" referenceid ", -1); 107 if( pos > 0 && this. contactadapter!= null ) { 108 contactadapter. remove ( ( String ) getlistadapter (). getitem ( pos ) ); 109 contactadapter. insert (name, pos ); 110 contactadapter. sort ( null ); 111 } else { 112 Log.d( MainActivity. MM_WARNING, this. getclass (). getsimplename () + ": " + " referenceid was

33 C.1. Java source code } transmitted - contact couldn t be saved "); 116 Toast. maketext (this, " Contact saved ", Toast. LENGTH_LONG ). show (); 117 } 118 } // TODO Auto - generated method stub 121 super. onactivityresult ( requestcode, resultcode, data ); 122 } 123 Override 125 protected void onresume () { 126 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onresume ()"); 127 // TODO Auto - generated method stub 128 super. onresume (); } }

34 C.1. Java source code 34 Listing C.4: ContactInformationActivity.java 1 package mm.dev. contact ; 2 3 import mm.dev. contact.r; 4 import android. app. Activity ; 5 import android. content. Intent ; 6 import android.os. Bundle ; 7 import android. util. Log ; 8 import android. view. View ; 9 import android. view. Window ; 10 import android. widget. EditText ; public class ContactInformationActivity extends Activity { private int referenceid = 0; 15 Override 17 protected void oncreate ( Bundle savedinstancestate ) { 18 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering oncreate ()"); 19 // TODO Auto - generated method stub 20 super. oncreate ( savedinstancestate ); 21 // remove Widget - Titlebar 22 this. requestwindowfeature ( Window. FEATURE_ NO_ TITLE ); 23 setcontentview ( R. layout. contact_ detail ); // reading data committed by partent activty - through the intent. 26 final Bundle data = getintent (). getextras (); this. referenceid = data. getint (" referenceid "); // setting value of Fore - and Surname - Field. 31 (( EditText ) this. findviewbyid ( R.id. editvorname )). settext ( data. getstring (" vorname ") ); 32 (( EditText ) this. findviewbyid ( R.id. editnachname )). settext ( data. getstring (" nachname ") ); } public void saveandclose ( final View view ) { 37 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering saveandclose () "); Intent changes = new Intent (); 40 // putting data to the result intent 41 changes. putextra (" referenceid ", this. referenceid );

35 C.1. Java source code changes. putextra (" vorname ", (( EditText ) this. findviewbyid ( R.id. editvorname )). gettext (). tostring ()); 43 changes. putextra (" nachname ", (( EditText ) this. findviewbyid (R.id. editnachname )). gettext (). tostring ()); Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " setting result status : RESULT_ OK and committing intent data "); 46 setresult ( RESULT_ OK, changes ); 47 finish (); 48 } Override 53 public void onbackpressed () { 54 Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " Entering onbackpressed ()"); 55 // TODO Auto - generated method stub 56 super. onbackpressed (); Log.d( MainActivity. MM_INFORMATION, this. getclass (). getsimplename () + ": " + " setting result status : RESULT_CANCELED "); 59 setresult ( RESULT_ CANCELED, null ); 60 finish (); 61 } }

36 C.2. XML (layout) source code 36 C.2 XML (layout) source code Listing C.5: AndroidManifestxml 1 <? xml version =" 1.0 " encoding ="utf -8"?> 2 < manifest xmlns:android =" http: // schemas. android. com / apk / res / android " 3 package ="mm.dev. contact " 4 android:versioncode ="1" 5 android: versionname =" 1.0 " > 6 7 <uses - sdk android:minsdkversion ="11" /> 8 <uses - permission android:name =" android. permission. READ_CONTACTS "/> 9 <uses - permission android:name =" android. permission. CAMERA " /> < application 12 android:icon / ic_launcher " 13 android:label / app_name " > 14 < activity android: name =" MainActivity " > 15 <intent - filter > 16 < action android:name =" android. intent. action. MAIN " /> < category android:name =" android. intent. category. LAUNCHER " /> 19 </ intent - filter > 20 </ activity > 21 < activity android:name =" ContactExplorerActivity " android:label / app_name " ></ activity > 22 < activity android:name =" ContactInformationActivity ">< / activity > 23 < activity android: name =" CameraActivity " > </ activity > </ application > </ manifest >

37 C.2. XML (layout) source code 37 Listing C.6: main.xml 1 <? xml version =" 1.0 " encoding ="utf -8"?> 2 < LinearLayout xmlns:android =" http: // schemas. android. com / apk / res / android " 3 android: layout_ width =" match_ parent " 4 android:layout_height =" match_parent " 5 android: gravity =" center_ horizontal center_ vertical " 6 android: orientation =" vertical " > 7 8 < Button 9 android:id ="@+id/ contactbutton " 10 android: layout_ width =" wrap_ content " 11 android:layout_height =" wrap_content " 12 android:layout_marginbottom ="40 dip " 13 android: onclick =" onchoose " 14 android:text / bt_init_contact " 15 android:textsize ="14 pt" 16 android:padding ="10 dip " 17 android:background =" # ED" 18 /> <Button 21 android:id ="@+id/ camerabutton " 22 android: layout_ width =" wrap_ content " 23 android:layout_height =" wrap_content " 24 android:layout_margintop ="40 dip " 25 android:text / bt_init_camera " 26 android: onclick =" onchoose " 27 android:textsize ="14 pt" 28 android:padding ="10 dip " 29 android:background =" # ED" 30 /> </ LinearLayout >

38 C.2. XML (layout) source code 38 Listing C.7: Camera-View.xml 1 <? xml version =" 1.0 " encoding ="utf -8"?> 2 < LinearLayout xmlns:android =" http: // schemas. android. com / apk / res / android " 3 android: layout_ width =" match_ parent " 4 android:layout_height =" match_parent " 5 android: gravity =" center_ horizontal " > 6 7 < TableLayout 8 android: layout_ width =" wrap_ content " 9 android:layout_height =" match_parent " > < TableRow 12 android:id ="@+id/ tablerow2 " 13 android: layout_ width =" wrap_ content " 14 android:layout_height =" wrap_content " > < Button 17 android:id ="@+id/ button1 " 18 android: layout_ width =" wrap_ content " 19 android:layout_height =" wrap_content " 20 android:layout_margintop ="30 dip " 21 android:layout_marginbottom ="20 dip " 22 android: onclick =" takepicture " 23 android:text / bt_take_picture " 24 android:padding ="5 dip " 25 android:background =" # ED" /> </ TableRow > < TableRow 30 android:id ="@+id/ tablerow1 " 31 android: layout_ width =" wrap_ content " 32 android:layout_height =" wrap_content " 33 android: gravity =" center " > < TextView 36 android:id ="@+id/ pictureheadline " 37 android: layout_ width =" wrap_ content " 38 android:layout_height =" wrap_content " 39 android:text / tx_no_picture " 40 /> </ TableRow > < TableRow 45 android:id ="@+id/ tablerow3 " 46 android: layout_ width =" wrap_ content "

39 C.2. XML (layout) source code android:layout_height =" wrap_content " > < ImageView 50 android:id cameraimage " 51 android: layout_ width =" wrap_ content " 52 android:layout_height =" 300 dip " 53 android:contentdescription / ds_ pic_ description " / > </ TableRow > </ TableLayout > </ LinearLayout >

40 C.2. XML (layout) source code 40 Listing C.8: Contact-Detail.xml 1 <? xml version =" 1.0 " encoding ="utf -8"?> 2 < LinearLayout xmlns:android =" http: // schemas. android. com / apk / res / android " 3 android: layout_ width =" match_ parent " 4 android:layout_height =" match_parent " 5 android: gravity =" center_ horizontal " 6 android: orientation =" vertical " > 7 8 < TableLayout 9 android: layout_ width =" match_ parent " 10 android:layout_height =" wrap_content " 11 android:layout_margintop ="10 dip " > < TableRow 14 android:id ="@+id/ tablerow1 " 15 android: layout_ width =" wrap_ content " 16 android:layout_height =" wrap_content " 17 android:layout_marginbottom ="5 dip " > < TextView 20 android: layout_ width =" wrap_ content " 21 android:layout_height =" wrap_content " 22 android:text / tx_vorname " 23 android:padding ="5 dip "/> < EditText 26 android:id ="@+id/ editvorname " 27 android: layout_ width =" wrap_ content " 28 android:layout_height =" wrap_content " 29 android:ems ="10" 30 android: inputtype =" text " 31 > < requestfocus / > 34 </ EditText > </ TableRow > < TableRow 39 android:id ="@+id/ tablerow2 " 40 android: layout_ width =" wrap_ content " 41 android:layout_height =" wrap_content " > < TextView 44 android: layout_ width =" wrap_ content " 45 android:layout_height =" wrap_content " 46 android:text / tx_nachname "

41 C.2. XML (layout) source code android:padding ="5 dip "/> < EditText 50 android:id editnachname " 51 android: layout_ width =" wrap_ content " 52 android:layout_height =" wrap_content " 53 android:ems ="10" 54 android:inputtype =" text " /> </ TableRow > < TableRow 59 android:id tablerow3 " 60 android: layout_ width =" wrap_ content " 61 android:layout_height =" wrap_content " > 62 </ TableRow > < TableRow 65 android:id tablerow4 " 66 android: layout_ width =" wrap_ content " 67 android:layout_height =" wrap_content " > < TableRow 70 android:id tablerow5 " 71 android: layout_ width =" wrap_ content " 72 android:layout_height =" wrap_content " > 73 </ TableRow > </ TableRow > 76 </ TableLayout > < Button 79 android:id savecontactinformations " 80 android: layout_ width =" wrap_ content " 81 android:layout_height =" wrap_content " 82 android:text / bt_save_contact " 83 android: onclick =" saveandclose " 84 android:layout_margintop ="50 dip " 85 android:background =" # ED" 86 android:padding ="5 dip " /> </ LinearLayout >

42 C.2. XML (layout) source code 42 Listing C.9: Contact-Overview.xml 1 <? xml version =" 1.0 " encoding ="utf -8"?> 2 < LinearLayout xmlns:android =" http: // schemas. android. com / apk / res / android " 3 android:layout_width =" fill_parent " 4 android:layout_height =" fill_parent " 5 android: orientation =" vertical " 6 android:padding ="10 dip "> 7 8 < ListView 9 android:id ="@+id/ android:list " 10 android: layout_ width =" fill_ parent " 11 android:layout_height =" wrap_content " > 12 </ ListView > </ LinearLayout >

43 C.2. XML (layout) source code 43 Listing C.10: values.xml 1 <? xml version =" 1.0 " encoding ="utf -8"?> 2 < resources > 3 4 <! -- MainActivity START -- > 5 6 <! -- Textviews / Descriptions -- > 7 8 <! -- Buttons --> 9 <string name =" bt_init_contact ">Contact - Example </ string > 10 <string name =" bt_init_camera ">Camera - Example </ string > <! -- Main END --> <! -- ContactExplorerActivity START --> <! -- Textviews / Descriptions -- > 20 < string name =" app_name "> ContactAndCameraExplorer </ string > <! -- Buttons --> <! -- ContactExplorerActivity END --> <! -- ContactInformationActivity START --> <! -- Textviews / Descriptions -- > 32 < string name =" tx_vorname ">Forename: </ string > 33 < string name =" tx_nachname ">Surname: </ string > <! -- Buttons --> 36 < string name =" bt_ save_ contact " > Save contact informations < / string > <! -- ContactInformationActivity END --> <! -- CameraActivity START -- > <! -- Textviews / Descriptions -- > 44 < string name =" tx_ taken_ picture " > Recently taken picture: </ string > 45 <string name =" tx_no_picture ">No picture taken.</ string >

44 C.2. XML (layout) source code <! -- Buttons --> 47 < string name =" bt_take_picture ">Take a new picture </ string > < string name =" ds_ pic_ description " > Picture take via the Camera </ string > <! -- CameraActivity END -- > </ resources >

The Suggest Example layout (cont ed)

The Suggest Example layout (cont ed) Using Web Services 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 7: Working with Web Services Android provides a full set of Java-standard networking APIs, such as the java.net package containing among

More information

This lecture. The BrowserIntent Example (cont d)

This lecture. The BrowserIntent Example (cont d) This lecture 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 10: Working with the Web Browser Dr Dimitris C. Dracopoulos Android provides a full-featured web browser based on the Chromium open source

More information

Introduction To Android

Introduction To Android Introduction To Android Mobile Technologies Symbian OS ios BlackBerry OS Windows Android Introduction to Android Android is an operating system for mobile devices such as smart phones and tablet computers.

More information

Android User Interface

Android User Interface Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 20. Oktober 2014 Outline 1 Android User Interface 2 Multi-Language Support 3 Summary Matthias Keil Android

More information

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based

More information

BCA 6. Question Bank

BCA 6. Question Bank BCA 6 030010601 : Introduction to Mobile Application Development Question Bank Unit 1: Introduction to Android and Development tools Short questions 1. What kind of tool is used to simulate Android application?

More information

Lab 3. Accessing GSM Functions on an Android Smartphone

Lab 3. Accessing GSM Functions on an Android Smartphone Lab 3 Accessing GSM Functions on an Android Smartphone 1 Lab Overview 1.1 Goals The objective of this practical exercise is to create an application for a smartphone with the Android mobile operating system,

More information

Android User Interface Android Smartphone Programming. Outline University of Freiburg

Android User Interface Android Smartphone Programming. Outline University of Freiburg Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 20. Oktober 2014 Outline 1 2 Multi-Language Support 3 Summary Matthias Keil 20. Oktober 2014 2 / 19 From

More information

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011 Android for Ubiquitous Computing Researchers Andrew Rice University of Cambridge 17-Sep-2011 Getting started Website for the tutorial: http://www.cl.cam.ac.uk/~acr31/ubicomp/ Contains links to downloads

More information

Creating a User Interface

Creating a User Interface Creating a User Interface Developing for Android devices is a complicated process that requires precision to work with. Android runs on numerous devices from smart-phones to tablets. Instead of using a

More information

O X X X O O X O X. Tic-Tac-Toe. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 2: The Ultimate Tic-Tac-Toe Game

O X X X O O X O X. Tic-Tac-Toe. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 2: The Ultimate Tic-Tac-Toe Game Tic-Tac-Toe 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 2: The Ultimate Tic-Tac-Toe Game Dr Dimitris C. Dracopoulos O X X X O O X O X The Ultimate Tic-Tac-Toe: Rules of the Game Dimitris C. Dracopoulos

More information

BCS3283-Mobile Application Development

BCS3283-Mobile Application Development For updated version, please click on http://ocw.ump.edu.my BCS3283-Mobile Application Development Chapter 7 Intent Editor Dr. Mohammed Falah Mohammed Faculty of Computer Systems & Software Engineering

More information

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming University of Babylon College of Information Technology Department of Information Networks Mobile Fundamentals and Programming Lecture 7: Data Persistence : shared preferences Lecturer : Ali Kadhim Al-Bermani

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming Emmanuel Agu Android Apps: Big Picture UI Design using XML UI design code (XML) separate from the program (Java) Why?

More information

Android Programming (5 Days)

Android Programming (5 Days) www.peaklearningllc.com Android Programming (5 Days) Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse tools. This Android

More information

Lab 1 - Setting up the User s Profile UI

Lab 1 - Setting up the User s Profile UI Lab 1 - Setting up the User s Profile UI Getting started This is the first in a series of labs that allow you to develop the MyRuns App. The goal of the app is to capture and display (using maps) walks

More information

14.1 Overview of Android

14.1 Overview of Android 14.1 Overview of Android - Blackberry smart phone appeared in 2003 First widely used mobile access to the Web - Smart phone market now dominated by Android, iphone, and Windows Phone - Tablets are now

More information

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment FRAGMENTS Fragments An activity is a container for views When you have a larger screen device than a phone like a tablet it can look too simple to use phone interface here. Fragments Mini-activities, each

More information

ECOM 5341 Mobile Computing(Android) Eng.Ruba A. Salamah

ECOM 5341 Mobile Computing(Android) Eng.Ruba A. Salamah ECOM 5341 Mobile Computing(Android) 1 Eng.Ruba A. Salamah Lecture # 2 Android Tools Objectives Understand Android Tools Setup Android Development Environment Create HelloWorld Application Understand HelloWorld

More information

Configuring the Android Manifest File

Configuring the Android Manifest File Configuring the Android Manifest File Author : userone What You ll Learn in This Hour:. Exploring the Android manifest file. Configuring basic application settings. Defining activities. Managing application

More information

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

ANDROID APPS DEVELOPMENT FOR MOBILE GAME ANDROID APPS DEVELOPMENT FOR MOBILE GAME Application Components Hold the content of a message (E.g. convey a request for an activity to present an image) Lecture 2: Android Layout and Permission Present

More information

INTRODUCTION TO ANDROID

INTRODUCTION TO ANDROID INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Application Components Hold the content of a message (E.g. convey a request for an activity to present an image) Lecture 2: Android Programming

More information

MC Android Programming

MC Android Programming MC1921 - Android Programming Duration: 5 days Course Price: $3,395 Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse

More information

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android Ing. Elton Domnori December 7, 2011 Mobile OS Symbian BlackBerry Window mobile Android ios Mobile OS OS First release Last release Owner Android Android 1.0 September 2008 Android 4.0 May 2011 Open Handset

More information

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling Lecture 1 Review How to edit XML files in Android Studio? What holds all elements (Views) that appear to the user in an Activity?

More information

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie User Interface Design" & Development -

More information

Mobile and Wireless Systems Programming

Mobile and Wireless Systems Programming to Android Android is a software stack for mobile devices that includes : an operating system middleware key applications Open source project based on Linux kernel 2.6 Open Handset Alliance (Google, HTC,

More information

SQLite. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases. What is a Database Server. Advantages of SQLite

SQLite. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases. What is a Database Server. Advantages of SQLite SQLite 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases Dr Dimitris C. Dracopoulos SQLite is a tiny yet powerful database engine. Besides Android, it can be found in: Apple iphone

More information

CS 234/334 Lab 1: Android Jump Start

CS 234/334 Lab 1: Android Jump Start CS 234/334 Lab 1: Android Jump Start Distributed: January 7, 2014 Due: Friday, January 10 or Monday, January 13 (in-person check off in Mobile Lab, Ry 167). No late assignments. Introduction The goal of

More information

The drawable/tile empty.xml file

The drawable/tile empty.xml file The X and O Symbols 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 3: Ultimate Tic-Tac-Toe Game: The Interface Dr Dimitris C. Dracopoulos Create them with the filenames x blue.png and o red.png in an

More information

Android Application Development

Android Application Development Android Application Development Octav Chipara What is Android A free, open source mobile platform A Linux-based, multiprocess, multithreaded OS Android is not a device or a product It s not even limited

More information

Mobile User Interfaces

Mobile User Interfaces Mobile User Interfaces CS 2046 Mobile Application Development Fall 2010 Announcements Next class = Lab session: Upson B7 Office Hours (starting 10/25): Me: MW 1:15-2:15 PM, Upson 360 Jae (TA): F 11:00

More information

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard.

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. 44 CHAPTER 2 Android s development environment Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. TIP You ll want the package name of your applications to be unique

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming Emmanuel Agu Editting in Android Studio Recall: Editting Android Can edit apps in: Text View: edit XML directly Design

More information

COSC 3P97 Mobile Computing

COSC 3P97 Mobile Computing COSC 3P97 Mobile Computing Mobile Computing 1.1 COSC 3P97 Prerequisites COSC 2P13, 3P32 Staff instructor: Me! teaching assistant: Steve Tkachuk Lectures (MCD205) Web COSC: http://www.cosc.brocku.ca/ COSC

More information

ES E 3 3 L a L b 5 Android development

ES E 3 3 L a L b 5 Android development ES3 Lab 5 Android development This Lab Create a simple Android interface Use XML interface layouts Access the filesystem Play media files Info about Android development can be found at http://developer.android.com/index.html

More information

GUI Design for Android Applications

GUI Design for Android Applications GUI Design for Android Applications SE3A04 Tutorial Jason Jaskolka Department of Computing and Software Faculty of Engineering McMaster University Hamilton, Ontario, Canada jaskolj@mcmaster.ca November

More information

Android App Development

Android App Development Android App Development Course Contents: Android app development Course Benefit: You will learn how to Use Advance Features of Android with LIVE PROJECTS Original Fees: 15000 per student. Corporate Discount

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples Emmanuel Agu Android UI Design in XML Recall: Files Hello World Android Project XML file used to design Android UI

More information

Using Eclipse for Android Development

Using Eclipse for Android Development 3 Using Eclipse for Android Development This chapter is an introduction to building a complete Android app. The chapter includes creating a new app project, exploring the components of an Android app,

More information

MOBILE CLIENT FOR ONLINE DICTIONARY. Constantin Lucian ALDEA 1. Abstract

MOBILE CLIENT FOR ONLINE DICTIONARY. Constantin Lucian ALDEA 1. Abstract Bulletin of the Transilvania University of Braşov Vol 4(53), No. 2-2011 Series III: Mathematics, Informatics, Physics, 123-128 MOBILE CLIENT FOR ONLINE DICTIONARY Constantin Lucian ALDEA 1 Abstract The

More information

Android. Michael Greifeneder. Image source: Android homepage

Android. Michael Greifeneder. Image source: Android homepage Android Michael Greifeneder Image source: Android homepage Inhalt Overwiew Hardware Software Development Demo Tools Basics Debugging/Emulator Location Android And Me Why I like Android Blend of Linux and

More information

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing

More information

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH Android Basics - Bhaumik Shukla Android Application Developer @ STEALTH FLASH Introduction to Android Android is a software stack for mobile devices that includes an operating system, middleware and key

More information

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle CS378 -Mobile Computing Anatomy of and Android App and the App Lifecycle Hello Android Tutorial http://developer.android.com/resources/tutorials/hello-world.html Important Files src/helloandroid.java Activity

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Teodoro Montanaro Politecnico di Torino, 2016/2017 Disclaimer This is only a fast introduction: It is not complete (only scrapes the surface) Only superficial

More information

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING This document can be downloaded from www.chetanahegde.in with most recent updates. 1 MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING Syllabus: What is Android? Obtaining the required tools, Anatomy

More information

Applications. Marco Ronchetti Università degli Studi di Trento

Applications. Marco Ronchetti Università degli Studi di Trento Applications Marco Ronchetti Università degli Studi di Trento Android Applications An Android application typically consists of one or more related, loosely bound activities for the user to interact with.

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Alberto Monge Roffarello Politecnico di Torino, 2017/2018 Some slides and figures are taken from the Mobile Application Development (MAD) course Disclaimer

More information

Developing Android Applications

Developing Android Applications Developing Android Applications Introduction to Software Engineering Fall 2015 Updated 21 October 2015 Android Lab 02 Advanced Android Features 2 Class Plan UI Elements Activities Intents Data Transfer

More information

COPYRIGHTED MATERIAL. 1Getting Started with Android Programming

COPYRIGHTED MATERIAL. 1Getting Started with Android Programming 1Getting Started with Android Programming WHAT YOU WILL LEARN IN THIS CHAPTER What is Android? Android versions and its feature set The Android architecture The various Android devices on the market The

More information

CS371m - Mobile Computing. User Interface Basics

CS371m - Mobile Computing. User Interface Basics CS371m - Mobile Computing User Interface Basics Clicker Question Have you ever implemented a Graphical User Interface (GUI) as part of a program? A. Yes, in another class. B. Yes, at a job or internship.

More information

Android Development Tutorial. Yi Huang

Android Development Tutorial. Yi Huang Android Development Tutorial Yi Huang Contents What s Android Android architecture Android software development Hello World on Android More 2 3 What s Android Android Phones Sony X10 HTC G1 Samsung i7500

More information

12 Publishing Android Applications

12 Publishing Android Applications 12 Publishing Android Applications WHAT YOU WILL LEARN IN THIS CHAPTER How to prepare your application for deployment Exporting your application as an APK fi le and signing it with a new certificate How

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Emmanuel Agu What is Android? Android is world s leading mobile operating system Open source Google: Owns Android, maintains it,

More information

ANDROID SYLLABUS. Advanced Android

ANDROID SYLLABUS. Advanced Android Advanced Android 1) Introduction To Mobile Apps I. Why we Need Mobile Apps II. Different Kinds of Mobile Apps III. Briefly about Android 2) Introduction Android I. History Behind Android Development II.

More information

Android Programming Lecture 2 9/7/2011

Android Programming Lecture 2 9/7/2011 Android Programming Lecture 2 9/7/2011 Creating a first app 1. Create a new Android project (a collection of source code and resources for the app) from the Eclipse file menu 2. Choose a project name (can

More information

A view is a widget that has an appearance on screen. A view derives from the base class android.view.view.

A view is a widget that has an appearance on screen. A view derives from the base class android.view.view. LAYOUTS Views and ViewGroups An activity contains Views and ViewGroups. A view is a widget that has an appearance on screen. A view derives from the base class android.view.view. One or more views can

More information

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna Programming with Android: System Architecture Luca Bedogni Marco Di Felice Dipartimento di Scienze dell Informazione Università di Bologna Outline Android Architecture: An Overview Android Dalvik Java

More information

Mobile Application Development - Android

Mobile Application Development - Android Mobile Application Development - Android MTAT.03.262 Satish Srirama satish.srirama@ut.ee Goal Give you an idea of how to start developing Android applications Introduce major Android application concepts

More information

SHWETANK KUMAR GUPTA Only For Education Purpose

SHWETANK KUMAR GUPTA Only For Education Purpose Introduction Android: INTERVIEW QUESTION AND ANSWER Android is an operating system for mobile devices that includes middleware and key applications, and uses a modified version of the Linux kernel. It

More information

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license Android Android Mobile operating system developed by Google A complete stack OS, framework A rich set of applications Email, calendar, browser, maps, text messaging, contacts, camera, dialer, music player,

More information

Android Beginners Workshop

Android Beginners Workshop Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 8 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

Pro Android 2. Sayed Y. Hashimi Satya Komatineni Dave Mac Lean. Apress

Pro Android 2. Sayed Y. Hashimi Satya Komatineni Dave Mac Lean. Apress Pro Android 2 Sayed Y. Hashimi Satya Komatineni Dave Mac Lean Apress Contents Contents at a Glance Contents About the Authors About the Technical Reviewer Acknowledgments Foreword iv v xiii xiv xv xvi

More information

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices. Group B: Assignment No 8 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: To verify the operating system name and version of Mobile devices. Problem Definition: Write a

More information

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna Programming with Android: System Architecture Luca Bedogni Marco Di Felice Dipartimento di Scienze dell Informazione Università di Bologna Outline Android Architecture: An Overview Android Dalvik Java

More information

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015 Android System Architecture Android Application Fundamentals Applications in Android All source code, resources, and data are compiled into a single archive file. The file uses the.apk suffix and is used

More information

CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android Emmanuel Agu What is Android? Android is world s leading mobile operating system Open source (https://source.android.com/setup/)

More information

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Activity Basics Manifest File AndroidManifest.xml Central configuration of Android application Defines: Name of application Icon for

More information

Topics Covered in the Android Apps Development Training

Topics Covered in the Android Apps Development Training Topics Covered in the Android Apps Development Training 1. Android Architecture sdk, jdk, class files,.dex, installation, sdk manager, avd manager, avd configurations, emulator, Android Framework Versions,

More information

Real-Time Embedded Systems

Real-Time Embedded Systems Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51 Smart phones

More information

Introduction to Android Development

Introduction to Android Development Introduction to Android Development What is Android? Android is the customizable, easy to use operating system that powers more than a billion devices across the globe - from phones and tablets to watches,

More information

Developer s overview of the Android platform

Developer s overview of the Android platform Developer s overview of the Android platform Erlend Stav SINTEF November 10, 2009 mailto:erlend.stav@sintef.no 1 Overview Vendors and licensing Application distribution Platform architecture Application

More information

CMSC436: Fall 2013 Week 3 Lab

CMSC436: Fall 2013 Week 3 Lab CMSC436: Fall 2013 Week 3 Lab Objectives: Familiarize yourself with the Activity class, the Activity lifecycle, and the Android reconfiguration process. Create and monitor a simple application to observe

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu Android UI Tour Home Screen First screen after unlocking phone or hitting home button Includes favorites tray

More information

The World of Android Development

The World of Android Development The World of Android Development Java Concepts The Big Difference WEB APPS & MOBILE APPS Advantages of Web apps o Universal access Browsers are everywhere Any device on the network can access content PCs,

More information

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu Android UI Tour Home Screen First screen, includes favorites tray (e.g phone, mail, messaging, web, etc)

More information

Introduction to Android Android Smartphone Programming. Outline University of Freiburg. What is Android? Background University of Freiburg.

Introduction to Android Android Smartphone Programming. Outline University of Freiburg. What is Android? Background University of Freiburg. Introduction to Android Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering October 19, 2015 Outline 1 What is Android? 2 3 Applications: A Quick Glimpse

More information

Android. (XKE Mars 2009) Erwan Alliaume.

Android. (XKE Mars 2009) Erwan Alliaume. Android (XKE Mars 2009) Erwan Alliaume ealliaume(*at*)xebia(*dot*)fr http://www.xebia.fr http://blog.xebia.fr History August 2005 Google acquires Android November 2007 Open Handset Alliance announcement

More information

COMP4521 EMBEDDED SYSTEMS SOFTWARE

COMP4521 EMBEDDED SYSTEMS SOFTWARE COMP4521 EMBEDDED SYSTEMS SOFTWARE LAB 1: DEVELOPING SIMPLE APPLICATIONS FOR ANDROID INTRODUCTION Android is a mobile platform/os that uses a modified version of the Linux kernel. It was initially developed

More information

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics Chapter 10 Speech Recognition 10.1 Introduction Speech recognition (SR) by machine, which translates spoken words into text has been a goal of research for more than six decades. It is also known as automatic

More information

Lab 1: Getting Started With Android Programming

Lab 1: Getting Started With Android Programming Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Eng. Jehad Aldahdooh Mobile Computing Android Lab Lab 1: Getting Started With Android Programming To create a new Android Project

More information

Android Development Tools = Eclipse + ADT + SDK

Android Development Tools = Eclipse + ADT + SDK Lesson 2 Android Development Tools = Eclipse + ADT + SDK Victor Matos Cleveland State University Portions of this page are reproduced from work created and shared by Google and used according to terms

More information

M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 2

M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 2 M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 2 1) What is Intent? How it is useful for transitioning between various activities? How intents can be received & broadcasted. (Unit :-2, Chapter

More information

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Overview MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Lecture: MVC Model View Controller What is an App? Android Activity Lifecycle Android Debugging Fixing Rotations & Landscape Layouts Localization

More information

Eventually, you'll be returned to the AVD Manager. From there, you'll see your new device.

Eventually, you'll be returned to the AVD Manager. From there, you'll see your new device. Let's get started! Start Studio We might have a bit of work to do here Create new project Let's give it a useful name Note the traditional convention for company/package names We don't need C++ support

More information

Android App Development

Android App Development Android App Development Outline Introduction Android Fundamentals Android Studio Tutorials Introduction What is Android? A software platform and operating system for mobile devices Based on the Linux kernel

More information

User Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University

User Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University User Interface: Layout Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University http://twitter.com/krunapon Agenda User Interface Declaring Layout Common Layouts User Interface

More information

Android UI Development

Android UI Development Android UI Development Android UI Studio Widget Layout Android UI 1 Building Applications A typical application will include: Activities - MainActivity as your entry point - Possibly other activities (corresponding

More information

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location.

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location. 2011 Marty Hall Android Programming Basics Originals of Slides and Source Code for Examples: http://www.coreservlets.com/android-tutorial/ Customized Java EE Training: http://courses.coreservlets.com/

More information

Mobile Application Development

Mobile Application Development Mobile Application Development The principal goal of education is to create men and women who are capable of doing new things, not simply repeating what other generations have done. -Jean Piaget Mobile

More information

COLLEGE OF ENGINEERING, NASHIK-4

COLLEGE OF ENGINEERING, NASHIK-4 Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4 DEPARTMENT OF COMPUTER ENGINEERING 1) What is Android? Important Android Questions It is an open-sourced operating system that is used primarily

More information

LECTURE NOTES OF APPLICATION ACTIVITIES

LECTURE NOTES OF APPLICATION ACTIVITIES Department of Information Networks The University of Babylon LECTURE NOTES OF APPLICATION ACTIVITIES By College of Information Technology, University of Babylon, Iraq Samaher@inet.uobabylon.edu.iq The

More information

Mobile Programming Lecture 1. Getting Started

Mobile Programming Lecture 1. Getting Started Mobile Programming Lecture 1 Getting Started Today's Agenda About the Android Studio IDE Hello, World! Project Android Project Structure Introduction to Activities, Layouts, and Widgets Editing Files in

More information

Initialising the Views (GameFragment) 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 5: Ultimate Tic-Tac-Toe Game: The Interface (Part III)

Initialising the Views (GameFragment) 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 5: Ultimate Tic-Tac-Toe Game: The Interface (Part III) 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 5: Ultimate Tic-Tac-Toe Game: The Interface (Part III) Dr Dimitris C. Dracopoulos Making a Move (GameFragment) Dimitris C. Dracopoulos 1/22 Initialising

More information

ANDROID APP DEVELOPMENT

ANDROID APP DEVELOPMENT 0 Version 1.2 ANDROID APP DEVELOPMENT By AbhiAndroid 0 AbhiAndroid.com 1 Awesome Thank you for downloading this guide Hi, My name is Abhishek. I m 26 year old guy from India. I m on mission and my mission

More information

UNDERSTANDING ACTIVITIES

UNDERSTANDING ACTIVITIES Activities Activity is a window that contains the user interface of your application. An Android activity is both a unit of user interaction - typically filling the whole screen of an Android mobile device

More information

Android Overview. Most of the material in this section comes from

Android Overview. Most of the material in this section comes from Android Overview Most of the material in this section comes from http://developer.android.com/guide/ Android Overview A software stack for mobile devices Developed and managed by Open Handset Alliance

More information