311 likes | 755 Views
Android and Project Structure. Android. Android OS Built on Linux Kernel Phones Netbooks Readers Other???. Android. Dessert anyone? Android 1.X 1.5 – Cupcake (first stable/robust version) 1.6 – Donut (first ‘updatable’ version) Android 2.X 2.0 and 2.1 – Éclair
E N D
Android • Android OS • Built on Linux Kernel • Phones • Netbooks • Readers • Other???
Android • Dessert anyone? • Android 1.X • 1.5 – Cupcake (first stable/robust version) • 1.6 – Donut (first ‘updatable’ version) • Android 2.X • 2.0 and 2.1 – Éclair • Android 2.2 – Froyo • Android 2.3 – Gingerbread • Android 3.X - Honeycomb • Android 4.X • 4.0 – Ice Cream Sandwich • 4.1, 4.2, and 4.3 – Jelly Bean
Android • Versioning • Higher version addressed many issues • Better audio/video • Better sensing • Use of GPS • Multiple profiles per device • Other
Android • Android SDK (http://developer.android.com) • Windows, Linux, Mac • Utilizes the Java language • Different Libraries • Well-documented • http://developer.android.com/reference/packages.html • Freely downloaded
Android • Dalvik Virtual Machine • Android’s equivalent of JVM • Optimized for low memory-management • Written by Dan Bornstein (named after a village where relatives lived) • AVD • Android Virtual Device • Phone Emulation • Communication between Android and AVD/phone • ADB (Android Debug Bridge) • Allows access and control over emulators • listing devices, installing applications, copy files to SD card, etc. • DDMS (Dalvik Debug Monitor Service) • Communications with ADB to provide control • Telephony • Location • Other
Building Blocks of an Application • Activities • User interface screen • Each application can have multiple activities • Layout defined in .xml file • Functionality defined in .java file • Intents • Intention to perform a task • Explicitly stated in code • Launch an activity • Display a webpage • Broadcast a notification
Building Blocks of an Application • Services • Task that runs in the background • Music Player • RSS reader that updates an activity when a site is updated • Content Providers • Bundles data so it can be shared among multiple applications
Building Blocks of an Application • Resources • Images • Audio files • Constants • Stored in ‘res’ directory • Permissions • Must explicitly ask permission to perform tasks • Access web • Access GPS • Access Contacts
Project identification • When creating a new project, the following must be provided • Project name • Displayed in Eclipse to differentiate projects • Application name • Activity name • The first screen displayed when the application is launched • Package name • edu.csci153.name
Project components • Automatically created • AndroidManifest.xml • Referenced libraries • Important directories • gen (generated) • res (resources) • src (source)
Project components • AndroidManifest.xml • Global settings • Permissions • Activities • Intents • Referenced libraries • android.jar – standard Android library • can add other user-defined libraries
Project components • gen directory • Contains R.java • Automatically generated file • Contains pointers to: • widgets • files • folders • Never modified by programmer
Project components • res directory • All file names within this folder (or subfolders) must be lowercase • Contains other folders • drawable • Contains image files • layout • Contains .xml layout files • Usually one for each activity • layout-land folder must be created for landscape-specific views • values • Contains string pointers that can be used throughout the code
Project components • src directory • Contains the java source code • One .java file for each activity • .java file for source code and the corresponding .xml file for layout often have the same name