Your SlideShare is downloading. ×
0
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Theory of Computation: Lecture 30
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Theory of Computation: Lecture 30

1,747

Published on

1) Another characterization of primitive recursive functions …

1) Another characterization of primitive recursive functions
2) Reduction of function arguments in primitive recursive functions
3) Construction of a computable functions that enumerates all unary primitive recursive functions
4) There exist computable functions that are not primitive recursive
5) Class home page is at http://vkedco.blogspot.com/2011/08/theory-of-computation-home.html

Published in: Education, Technology, Spiritual
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,747
On Slideshare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Android Programming Lecture 01 Vladimir Kulyukin Department of Computer Science Utah State Universitywww.youtube.com/vkedco
  • 2. Outline ● Topics ● Learning Objectives ● Software Installation ● Documentation and Coding Resources ● Android OS ● Components of the Android Application ● XML Primerwww.youtube.com/vkedco
  • 3. Web Logistics ● The home page for this class is at http://vkedco.blogspot.com/2011/08/android-programming-home.html ● Check the home page periodically and follow the links to read the syllabus, access slides, download code, download assignments, look up contact information, grading policies, watch screencasts, etcwww.youtube.com/vkedco
  • 4. Topicswww.youtube.com/vkedco
  • 5. Android OS ● Background ● Software stack ● Activities vs. applications ● Activity life cycles ● Activity states ● Resources ● Android OS vs. iPhone OSwww.youtube.com/vkedco
  • 6. User Interfaces ● Views ● Layouts ● Widgets ● UI XML specificationwww.youtube.com/vkedco
  • 7. Intents, Receivers, Adapters ● Explicit Intents ● Implicit Intents ● Event Broadcasting with Intents ● Event Reception with Broadcast Receivers ● Adapters and Data Bindingwww.youtube.com/vkedco
  • 8. Files, Content Providers, Databases ● Saving and Loading Files ● SQLite Databases ● Access Exposure to Data Sources through Content Providers ● Content Provider Registration ● Native Content Providerswww.youtube.com/vkedco
  • 9. Location-Based Services ● What Are Location-Based Services? ● Configuring the Android Emulator for Location- Based Services ● Geocoding and Map-Based Activitieswww.youtube.com/vkedco
  • 10. Multimedia ● Playing Audio and Video ● Recording Audio and Video ● Using the Camera to Take and Process Pictureswww.youtube.com/vkedco
  • 11. Networking ● Internet Access ● HTML/XML Parsing ● Wi-Fiwww.youtube.com/vkedco
  • 12. Touchscreen ● Touch Event Capture ● Touch Screen Gesture Recognitionwww.youtube.com/vkedco
  • 13. Learning Objectiveswww.youtube.com/vkedco
  • 14. Learning Objectives ● Have an appreciation of the Android OS ● Know how to develop basic UIs ● Know how to broadcast and receive events ● Know how to manage data storage through files, databases, and content providers ● Know how to implement basic location-based services ● Know how to use audio and video utilitieswww.youtube.com/vkedco
  • 15. Learning Objectives ● Know how to access the Internet ● Know how to process URL data encoded in HTML/XML ● Know how to capture touchscreen events and recognize touchscreen gestures ● Become exposed to Android online resources and communitieswww.youtube.com/vkedco
  • 16. Documentation and Coding Resourceswww.youtube.com/vkedco
  • 17. Official Android Site http://developer.android.com/index.htmlwww.youtube.com/vkedco
  • 18. Texts Rito Meier Professional Android 2 Application Development Wiley Publisherswww.youtube.com/vkedco
  • 19. Texts Sayed Hashimi, Satya Komatineni, Dave MacLean Pro Android 2, APRESSwww.youtube.com/vkedco
  • 20. Texts Mark Murphy Beginning Android 2, APRESSwww.youtube.com/vkedco
  • 21. Pedagogical Principles ● I am your colleague, not a supervisor ● It is impossible to know everything about Android given the pace of change in mobile computing: do your own research and due diligence ● If you have a problem, google/bing/yahoo it: chances are someone else has had that problem or similar problem and posted a fix somewherewww.youtube.com/vkedco
  • 22. Software Installationwww.youtube.com/vkedco
  • 23. List of Software Tools ● OS: Windows (XP or later), Linux (Ubuntu 10.10), Mac OS (10.x or later) ● Java Development Kit (6 or later) http://java.sun.com/javase/downloads/index.jsp ● Android SDK http://developer.android.com/sdk/index.html ● Eclipse IDE ● ADT Plugin for Eclipse IDEwww.youtube.com/vkedco
  • 24. Java JDK and JRE ● Java Development Kit (JDK) – Required to develop applications in Java – Contains a Java compiler, debugger, documentation tools, and other tools ● Java Runtime Environment (JRE) – Allows you to run a Java applicationwww.youtube.com/vkedco
  • 25. Android SDK● Tools that help you develop mobile applications on the Android platform – Android Development Tools (ADT) Plugin – Android Emulator ● Device-emulation tool that you can use to design, debug, and test your applications in an actual Android run-time environment without an actual phone – Android Virtual Devices (AVDs) ● Virtual device configurations that you create, to model device characteristics in the Android Emulator ● Each AVD functions as an independent device with its own storage for user data, SD card, and so on.www.youtube.com/vkedco
  • 26. Why Eclipse ● Integrated development environment (IDE) – Similar to Microsoft Visual Studio – Not required for Android development ● Alternatives include – Command-line based tools only – Other IDEs, e.g., NetBeans ● Google documentation refers to Eclipse extensivelywww.youtube.com/vkedco
  • 27. Android OSwww.youtube.com/vkedco
  • 28. Background History ● There exists a great variety of mobile operating systems: Symbian OS, MS Windows Mobile, Mobile Linux, iPhone OS, Moblin, etc ● Great market fragmentation ● So far no single OS has become the de facto standard (I personally doubt there will ever be one mobile OS; more likely two or three major mobile OSs and a few minor ones)www.youtube.com/vkedco
  • 29. Background History ● In 2005, Google acquires the startup company Android, Inc. ● In 2005, the work begins on the Dalvik VM and other components of the Android Platform ● In 2007, the Open Handset Alliance is formed by a group of companies (Sprint, Motorola, Samsung, Sony Ericsson, Google, Intel, Texas Instruments, etc)www.youtube.com/vkedco
  • 30. Background History ● The Open Handset Alliance releases a lot of IP through the Apache License, Version 2.0 ● In Nov. 2007, the first version of the Android SDK is released ● In Sept. 2008, T-Mobile G1 becomes the 1st smartphone with the Android platform ● In Sept. 2009, Android 1.6 is released ● In Oct. 2009, Android 2.0 is releasedwww.youtube.com/vkedco
  • 31. Android vs. iPhone ● Operating Systems: Android apps can be developed on Windows, Linux, and Mac OS; iPhone apps only on a Mac ● Programming Languages: Android apps can be developed in Java, C/C++, and increasingly in Python and Perl; Objective C is the only choice for serious iPhone development for now ● Source Code Availability: Android is mostly open source; iPhone is 100% proprietarywww.youtube.com/vkedco
  • 32. Android vs. iPhone ● Third-party Software Distribution: There is a small entry fee for publishing Android apps on the Android market; there is an Apple-centered certification process to make your apps available in the App Store ● Different Philosophies: Bottom-up openness (Android) vs. Top-down quality control (iPhone)www.youtube.com/vkedco
  • 33. Android Software Stack USER APPLICATIONS UI Widgets Activities Services Multimedia Telephony Resources Java SE Connectivity SQLite DALVIK VM C LIBRARIES LINUXwww.youtube.com/vkedco
  • 34. Dalvik Virtual Machine ● Dalvik is the name of a town in Iceland ● Dalvik VM is written by Daniel Bornstein ● Dalvik VM takes the generated .class files and combines them into one or more .dex files (Dalvik executables) ● It reuses the information from .class files to reduce the size of the footprint ● Dalvik VM uses the registers as the primary source of data storage instead of the stackwww.youtube.com/vkedco
  • 35. Android Application Components through Proverbial Hello, Android!www.youtube.com/vkedco
  • 36. View ● A View is a UI building block: a text field, a label, a button, etc ● Views are hierarchical objects that know how to draw themselves ● J2EE and Swing use the same term - view ● In MS GUI lingo, views are controlswww.youtube.com/vkedco
  • 37. Activity ● An Activity is a single screen in an application ● An Activity typically contains at least one view ● An application may have several activitieswww.youtube.com/vkedco
  • 38. Intent ● A Message object that announces an intention ● An Intent can broadcast a message ● An Intent can start a service ● An Intent can launch an activity ● Intents are initiated by applicationswww.youtube.com/vkedco
  • 39. Content Provider ● A Mechanism (essentially, an API) for applications to share data without exposing the underlying storage details ● The underlying data can be stored in a file or a databasewww.youtube.com/vkedco
  • 40. Service ● A Background process that typically runs for a long time ● Example: an email application that polls for new messages ● Local services are services accessible to the hosting application ● Remote services are services that can be used by other applications on the devicewww.youtube.com/vkedco
  • 41. AndroidManifest.xml ● An XML file that defines the contents and behavior of the application ● It contains the list of activities in the application ● It contains intent filters, access permissions, use permissions, etcwww.youtube.com/vkedco
  • 42. XML Primerwww.youtube.com/vkedco
  • 43. XML Resources ● W3Schools XML Tutorial – http://www.w3schools.com/xml/default.asp ● IBM Developworks Introduction to XML – http://www.ibm.com/developerworks/xml/tutorials/xmlintro/index.htmlwww.youtube.com/vkedco
  • 44. XML ● XML is not just for Android ● XML is a critical component of modern software engineering – Mobile – Web – Databases – Data ● Most major languages now have libraries to support XMLwww.youtube.com/vkedco
  • 45. What is XML ● XML stands for eXtensible Markup Language ● It is extensible – You can define your own XML-document tags ● It uses markup – Uses tags, e.g. <LinearLayout> ● It is a language – A language for defining new languages, e.g., the UI specification language for Androidwww.youtube.com/vkedco
  • 46. Why XML ● XML gives documents a tree structure ● That structure can be exploited depending on how the data are used – Visual display – Information extraction ● HTML looks similar, but it lacks semantic structure ● XML is just text so can be viewed in an text editorwww.youtube.com/vkedco
  • 47. Sample XML <address> <name> <first-name>John</first-name> <last-name>Sorensen</last-name> </name> <street>4205 Old Main Hill</street> <city>Logan</city> <state>UT</state> <postal-code>84322</postal-code> </address>www.youtube.com/vkedco
  • 48. XML Terms ● Tags – Text between < and > – Starting tags – no slash ● <name> – Ending tags start with </ ● </name> ● Elements – Everything between a start and end tag ● The name element contains two elements: first and last namewww.youtube.com/vkedco
  • 49. Attributes ● Attributes – Name/value pair inside a start tag – Attribute values should be quoted – Original document has no attributes ● See next slide for altered versionwww.youtube.com/vkedco
  • 50. Attributes vs Elements ● Which is correct? – age is an element <person> <name>Cynthia</name> <age>25</age> </person> – age is an attribute <person age=”25”> <name>Cynthia</name> </person>www.youtube.com/vkedco
  • 51. Attribute vs. Elements ● Attributes – Cannot contain multiple values – Cannot contain tree structures – Not easily expandable ● Elements – Can contain multiple values – Can contain tree structures – Easily expandablewww.youtube.com/vkedco
  • 52. Writing XML ● Tag names are case sensitive ● Values in attributes must be quoted (single or double) ● Elements must be nested properly – This is OK: <employee><name>Bob</name></employee> – This is not OK: <employee><name>Bob</employee></name>www.youtube.com/vkedco
  • 53. Empty Elements ● Some elements may have no data between the start and end tags. ● If so, can shorten the code by ending tag with /> – Long form (John does not have a pet) <person> <name>John</name> <petName></petName> </person> – Short form <person> <name>John</name> <petName/> </person>www.youtube.com/vkedco
  • 54. XML Comments ● Start with <!-- and end with --> <bin_tree_node> <!-- this is a binary tree node --> <key>123</key> <value>nodes value</value> </bin_tree_node>www.youtube.com/vkedco
  • 55. Entities ● Some special characters are called entities in XML ● Must be written using predefined character entities – &lt; for less than ( < ) – &gt; for greater than ( > ) – &amp; for ampersand ( & ) – &apos; for apostrophe ( ) – &quot; for quotation mark (“)www.youtube.com/vkedco
  • 56. Entity example <test> <x>5</x> <comparison>&lt;</comparison> <y>10</y> <result>true</result> </test>www.youtube.com/vkedco
  • 57. XML Documents ● Each XML document starts with an XML declaration – Example: <?xml version="1.0"?> – Declaration may have additional attributes such as encodings for language <?xml version="1.0" encoding="utf-8" ?> – Each document has one root elementwww.youtube.com/vkedco
  • 58. XML Document <?xml version="1.0" encoding="utf-8" ?> <people> <person> <name>Bill</name> <age>21</age> </person> <person> <name>Sue</name> <age>22</age> </person> </people>www.youtube.com/vkedco
  • 59. XML Namespaces ● Anyone can define XML tags ● You may want to use the tags defined by both you and someone else – Both of you may define a similar tag ● XML namespaces provide a way to for similar tags to refer to different data – A title tag for a book – A title tag for the books authorwww.youtube.com/vkedco
  • 60. Defining an XML Namespace ● You will see an attribute starting with xmlns: – <bookstore xmlns:books="http://www.mystore.com/book" xmlns:author="http://www.mystore.com/book"> – The name after the : is the namespace – The value is just a string ● Often a URI since URIs are supposed to be uniquewww.youtube.com/vkedco
  • 61. Defining XML Document ● To define the tags, one creates one of these: – Document Type Definition (DTD) which defines ● the elements that can appear, ● the order in which they can appear ● how they can be nested inside each other, ● other basic details . – XML Schema. ● Can define same info as DTD ● Supports data types and more complicated rules ● We will not define any in this classwww.youtube.com/vkedco
  • 62. Handling XML Documents ● Document Object Model (DOM) Parsers – Read everything into memory – Treat XML like a tree ● Simple API for XML (SAX) Parsers – Treat XML like a stream – Generates events as data in the XML is read ● Android – Supports both types of parsers – Has additional support for handling GUI-related XMLwww.youtube.com/vkedco
  • 63. Feedback Bugs, errors to vladimir dot kulyukin at gmail dot comwww.youtube.com/vkedco

×