• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mobile Application Development: Lecture 02
 

Mobile Application Development: Lecture 02

on

  • 1,095 views

Mobile Application Development: Lecture 02 ...

Mobile Application Development: Lecture 02
1) Android AppDev Infrastructure
2) XML Primer - Quick Intro to Android Specs Formalism
3) Android App Anatomy
4) Building, Running, & Signing Android Apps

Statistics

Views

Total Views
1,095
Views on SlideShare
769
Embed Views
326

Actions

Likes
1
Downloads
0
Comments
0

26 Embeds 326

http://vkedco.blogspot.com 173
http://www.vkedco.blogspot.com 92
http://vkedco.blogspot.in 14
http://vkedco.blogspot.hu 8
http://vkedco.blogspot.de 7
http://www.vkedco.blogspot.in 4
http://vkedco.blogspot.com.es 3
http://vkedco.blogspot.fr 3
http://vkedco.blogspot.co.uk 3
http://vkedco.blogspot.co.il 2
http://vkedco.blogspot.gr 2
http://www.blogger.com 1
http://www.vkedco.blogspot.co.il 1
http://vkedco.blogspot.co.at 1
http://vkedco.blogspot.nl 1
http://vkedco.blogspot.pt 1
http://vkedco.blogspot.com.ar 1
http://www.vkedco.blogspot.kr 1
http://vkedco.blogspot.kr 1
http://vkedco.blogspot.com.au 1
http://vkedco.blogspot.cz 1
http://www.vkedco.blogspot.com.au 1
http://vkedco.blogspot.dk 1
http://vkedco.blogspot.se 1
http://www.vkedco.blogspot.co.uk 1
http://vkedco.blogspot.com.br 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Mobile Application Development: Lecture 02 Mobile Application Development: Lecture 02 Presentation Transcript

    • Mobile Application Development Lecture 02 Vladimir Kulyukin Department of Computer Science Utah State Universityhttp://www.youtube.com/vkedco www.vkedco.blogspot.com
    • Outline ● Android AppDev Infrastructure: What is What & What is Where ● XML Primer – Quick Intro to Android Specs Formalism ● Android App Anatomy ● Building, Running, & Signing Android Appshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android AppDev Infrastructurehttp://www.youtube.com/vkedco www.vkedco.blogspot.com
    • Android Root Directory After you install Android, your Android root directory (e.g., E:/Android/android-sdks) will likely look as follows (Linux and Mac installations will have the same logical structure)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android Root/add-ons ● /add-ons - 3rd party releases of Android; add-ons may require some licensing agreement (make sure you understand licensing before adopting an add-on) ● The most important sub-directories of an add-on are: – /images – system image files for Android devices – /libs – JAR files you need to include in your projects – /skins – available looks for Android devices – /samples – if present, contains sample projects with source codehttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android Root/platforms ● /platforms – specific platforms installed on your system (e.g., android-8, android-10, etc) ● Each platform directory will have, at least, the sub-directories: /data, /images, & /skins – /data – various resources (e.g., fonts, icons, etc) – /skins – looks of devices – /images – file system imageshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android Root/samples & /platform-tools ● /samples – sample projects for specific platforms ● /samples are a great way to learn Android development tricks (many of them are not well documented: you build them, run them, & study the source, modify it, etc) ● /platform-tools are applications and libraries you need for Android development – aapt (Android Asset Packaging Tool) – adb (Android Debug Bridge) – aidl (Android Interface Definition Language compiler)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android Root/sources ● /sources – source code from various companies and organizations ● /tools are applications and libraries you need for running and debugging Android apps – emulator – ddms (Dalvik Debug Monitor Server) – apkbuilder (APK stands for Android Package File; APK is a file format for Android application distribution; it is actually - ZIP) – hierarchyviewer (UI debugging and opitmization tool)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Tool Access & Versions ● Android Plugins for Eclipse make most tools available from within IDE ● If you are a command line developer, add /platform-tools and /tools to your PATH ● Android APIs tend to be backward compatible (modulo hardware restrictions) but some APIs do get depricated: you have to stay current on what is current on your target Android platformhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Primerhttp://www.youtube.com/vkedco www.vkedco.blogspot.com
    • What is XML ● XML stands for eXtensible Markup Language ● eXtensible, because you can define your own XML tags ● Markup because it uses tags to define document structure: <LinearLayout></LinearLayout> ● Language (in the formal sense), because it has a rigorous syntax and can be used for knowledge engineeringhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML & HTML ● Both XML and HTML give documents tree-like structures ● XML and HTML are similar but XML is considered more semantically flexible because of user-defined tags ● Unlike HTML that is typically rendered to be displayed in a browser, XML is just text and can be viewed in any text editorhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Sample XML <address> <name> <first-name>Daniel</first-name> <last-name>Watson</last-name> </name> <street>4205 Old Main Hill</street> <city>Logan</city> <state>UT</state> <postal-code></postal-code> </address>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Tags & Elements ● Tags – Text b/w matching < and > – Start tags without slash: <street> – End tags with slash: </street> ● Elements – Text b/w a pair of matching start and end tags <name> <first-name>Daniel</first-name> <last-name>Watson</last-name> </name>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Attributes ● Attributes – Name/value pair inside a start tag < and > – Attribute values are quoted ● Example: age is an attribute whose value is 28 <person age=”28”> <name>Daniel</name> </person>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Attributes vs. Elements ● Attributes – Cannot have multiple values – Cannot have tree sub-structures – Not easily expandable ● Elements – Can have multiple values – Can have tree sub-structures – More easily expandablehttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Attributes vs. Elements ● Element age <person> <name>Daniel</name> <age>28</age> </person> ● Attribute age <person age=”28”> <name>Daniel</name> </person>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Syntax ● Tags are case-sensitive: <Person></Person> is different from <person></person> ● End tags can be shortened to /> <uses-sdk android:minSdkVersion=”8” android:targetSdkVersion=”15” /> ● Elements must be nested properly: – This nesting is OK: <employee><name>Daniel</name></employee> – This nesting is not OK: <employee><name>Daniel</employee></name>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Comments ● Comments start with <!-- and end with --> ● Example: <!-- This is a binary tree node --> <bin_tree_node> <!-- this is nodes key --> <key>125</key> <!-- this is nodes key --> <value>string_125</value> </bin_tree_node>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Entities ● Some special characters are called entities in XML ● Examples: – &lt; less than (<) – &gt; greater than (>) – &amp; ampersand (&) – &apos; apostrophe () – &quot; quotation mark (“)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Entity Example <!-- 10 < 20 is True --> <bool_expression> <lhs_operand>10</lhs_operand> <comp_operator>&lt;</comp_operator> <rhs_operand>20</rhs_operand> <bool_result>True</bool_result> </bool_expression>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Document <!-- declaration --> <?xml version=”1.0” encoding=”utf-8” ?> <!-- employees is the root element --> <employees> <person> <name>Bill</name><age>25</age> </person> <person> <name>Sue</name><age>30</age> </person> </employees>http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Namespaces ● Namespaces are a tag collision resolution mechanism ● Different XML documents may reuse the same tags so long as these tags are used in different namespaces: – <title></title> in xmlns:books (books namespace) – <title></title> in xmlns:houses (houses namespace)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Namespaces ● Namespaces are defined as attributes that begin with xmlns: <bookstore xmlns:books=”http://www.mystore.com/books” xmlns:author=”http://www.mystore.com/books”> </bookstore> ● The name after xmlns: is the namespace ● The value is a string (often a unique URI)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • XML Tag Definitions ● Tag definitions can be explicitly controlled via – Document Type Definition (DTD) which defines ● Elements that can appear ● Order in which elements can appear ● Nesting rules – XML Schemas ● Same definitions as DTD ● Plus: Data types and complex data rules ● These mechanisms are beyond the scope of this classhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Parsing XML Documents ● Document Object Model (DOM) Parser – Read everything into memory – Manipulate XML documents as in-memory trees ● Simple API for XML (SAX) Parser – XML documents are input streams – Events and data are generated dynamically as XML streams are read ● XML Parsing on Android – Both DOM and XML are supported – Additional support for GUI XML specificationshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android App Anatomyhttp://www.youtube.com/vkedco www.vkedco.blogspot.com
    • Android App/AndroidManifest.xml ● AndroidManifest.xml is the glue that specifies & holds your app together (conceptually similar to Unix/Linux make files) ● Specifies your apps package, minimum & target SDK versions, your application and activities inside your applicationhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android App/src ● /src folder contains all your Java source code (packages & classes) ● Initial Activity class with two methods onCreate() and onCreateOptionsMenu() is auto-generatedhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android App/gen ● /gen folder contains all auto-generated Java source ● You should not modify it ● R.java is a very important class that defines constants that you need to programmatically access various elements of your applicationhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android App/assets, /bin, /libs, /res ● /assets - arbitraty user created files or file hierarchies not available through R.java ● /bin - .dex (Dalvik byte code), .apk and drawables ● /libs JARs for required by the app ● /res – XML and drawable resources available through R.javahttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Android App/res ● /res folder contains XML resources and drawables of various resolutions required for your app ● /res/drawable-xxxx - drawables of various resolutions ● /res/layout - XML UI specs for activities ● /res/menu – XML menu specs for activities ● /res/values – XML definitions of string constants and styleshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Building, Running, & Signing Android Appshttp://www.youtube.com/vkedco www.vkedco.blogspot.com
    • Building & Running Stepshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Building & Running Apps ● Eclipse ADT plugin builds your app incrementally as you make changes to it (check Project | Build Automatically menu option) ● The .apk file is saved in the /bin folder ● It is possible to develop in non-Eclipse environments: you can use the generated build.xml Ant file in the project directory ● The app must be signed (debug or release mode) to run on an AVD or a device ● Eclipse ADT automatically signs your app in debug modehttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • Building & Signing Apps Building Apps Signing Appshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
    • References ● developer.android.com ● developer.android.com/tools/building/index.html ● http://www.youtube.com/vkedcohttp://www.youtube.com/vkedco www.vkedco.blogspot.com
    • Feedback Bugs, errors to vladimir dot kulyukin at gmail dot comhttp://www.youtube.com/vkedco www.vkedco.blogspot.com