First Steps in Android
Upcoming SlideShare
Loading in...5
×
 

First Steps in Android

on

  • 1,414 views

Starting in Android

Starting in Android

Statistics

Views

Total Views
1,414
Views on SlideShare
1,412
Embed Views
2

Actions

Likes
1
Downloads
14
Comments
0

1 Embed 2

http://www.linkedin.com 2

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

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

    First Steps in Android First Steps in Android Presentation Transcript

    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE Android (Java) First Steps (By Rich Helton) Android (Rev 1) State of Colorado Office of Cyber Security State of Colorado Office of Cyber Security
    • AndroidCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  From http://en.wikipedia.org/wiki/Android_(operating_system),  Android is a software stack for mobile devices that includes an operating system, middleware and key applications.  Androids mobile operating system is based on the Linux kernel.  The Android open-source software stack consists of Java applications running on a Java-based, object-oriented application framework on top of Java core libraries running on a Dalvik virtual machine JIT compilation.  To me, Android is a Java framework with many underlying C libraries that run in an embedded Linux environment. As an embedded system, there are many performance and memory constraints based on hardware of a mobile device. State of Colorado Office of Cyber Security
    • Android piecesCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  For Database work, Android comes with a stripped down database server called SQLite, which is an embedded relational database management system. http://en.wikipedia.org/wiki/SQLite and www.sqlite.org  For Animation, OpenGL ES (Embedded Systems), is used for 3D and 2D graphics applications, http://en.wikipedia.org/wiki/OpenGL_ES  For the Android User Interface, the system uses a comparable RIA interface using the XML User Interface Language (XUL).  There are many other packages that will be discussed later, including the REST interface for WebServices, Telephony API, Search API, Google Maps and more. State of Colorado Office of Cyber Security
    • Android ManifestCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  The Android Manifest file is an XML file that will define your Android application’s resources. It is similar to a J2EE web.xml file.  Every Android application has one that will define many pieces to your application including images, permissions, UI pieces, and much more.  See http://developer.android.com/guide/topics/manifest/manifest-intro.html State of Colorado Office of Cyber Security
    • Android ManifestCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  A sample manifest file in Eclipse: State of Colorado Office of Cyber Security
    • Android APKCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Android will compile its project, including the manifest, into a APK file to run on the device, see http://en.wikipedia.org/wiki/APK_(file_format) State of Colorado Office of Cyber Security
    • Technical ResourcesCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Various Sample applications can be found at http://developer.android.com/resources/browser.html?tag=sample  A resource of Common tasks and how to do them in Android http://developer.android.com/resources/faq/commontasks.html such as displaying Alert Dialogs or Handling UI Events. State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE Android Development State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  To start Android development, the Java Development Kit needs to be installed locally. Depending on the local development environment will dictate which JDK to use.  After installing the JDK, you should install the Eclipse IDE, the most popular cross platform IDE for Java development, http://en.wikipedia.org/wiki/Eclipse_(software)  I like to use the Helios Eclipse for Java Developers http://www.eclipse.org/downloads/  Installing the SDK can be found at http://developer.android.com/sdk/installing.html State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  After installing Helios, the Android Development Toolkit can be installed as a plugin by using the the Help Menu-> Install New Software and Add https://dl-ssl.google.com/android/eclipse : State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Instead of using the Eclipse IDE, command line development can be done using the Android Software Development Kit (SDK).  The SDK can be installed, or downloaded, from http://developer.android.com/sdk/index.html  After installation, you will have a Android SDK and AVD Manager to manage the build packages and virtual devices: State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE The Eclipse IDE needs to point to the Android SDK packages, using Windows->Preferences->Android: State of Colorado Office of Cyber Security
    • Android Virtual Device (AVD)CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE An AVD will have to be created for debugging, this is your target device, http://developer.android.com/resources/tutorials/hello-world.html State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Let’s start a New Android in Eclipse, File -> New->Project, http://developer.android.com/guide/developing/projects/projects-eclipse.html : State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  A basic “HelloWorld” project: State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  A basic “HelloWorld” project in just the SDK, no Eclipse, from the SDK command line: State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Create some code, like showing a TextView with “Hello World”: State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Select Run-Run, select “Android Application” and wait for the emulator to start: State of Colorado Office of Cyber Security
    • Android DevelopmentCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  It prints: State of Colorado Office of Cyber Security
    • Android EmulatorCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  In order to debug/run an Android application, a Android emulator, to simulate a virtual phone will need to be set up through the ADT. See http://developer.android.com/guide/developing/tools/emulator.html  A hardware device can also be used, http://developer.android.com/guide/developing/device.html State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE Android UI State of Colorado Office of Cyber Security
    • Android UICYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  As mentioned earlier, XUL can be used to define the Android UI, instead of programmatic code like the previous TextView class.  Let’s look an example of XUL, using DroidDraw from http://droiddraw.org/ we can draw a UI and generate the XML: State of Colorado Office of Cyber Security
    • Droid DrawCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Showing TextView in DroidDraw: State of Colorado Office of Cyber Security
    • The ViewCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  The are several components to the UI.  One component is the View. TextView is derived from View.  The View class represents the basic building block for the interface components. http://developer.android.com/reference/android/view/View.html  The View can be part of ViewGroup, and needs to have defined layout http://developer.android.com/guide/topics/ui/index.html  A Layout will define how the View will display its objects, or widgets, http://developer.android.com/guide/topics/ui/layout-objects.html  The layout is the architecture for the UI in an Activity. It will define how the elements appear to the user, http://developer.android.com/guide/topics/ui/declaring-layout.html State of Colorado Office of Cyber Security
    • Hello, ViewsCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  http://developer.android.com/resources/tutorials/views/index.html contains a collection of different “Hello World” tutorials in various layouts.  An example is the Grid View, which displays items in a two- dimensional, scrollable grid. http://developer.android.com/resources/tutorials/views/hello-gridview.html  Others include Linear Layouts, Relatove Layout, Table Layout, Tab Layout, and List Views.  There are also tutorials for widgets like Date Picker, Time Picker, Google Maps, Web View, Gallery, Spinner, Form Stuff and Auto Complete. State of Colorado Office of Cyber Security
    • Droid DrawCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Using Droid Draw to display a Table Layout with a GridView and Radio Buttons: State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE The Emulator State of Colorado Office of Cyber Security
    • The EmulatorCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Using the Emulator http://developer.android.com/guide/developing/devices/emulator.html  There are several ways to interface to the Emulator, DDMS, ADB, and telnet. State of Colorado Office of Cyber Security
    • Package BrowserCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Menu->Package Browser State of Colorado Office of Cyber Security
    • TelnettingCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Telnet from the local machine “telnet localhost 5554”: “help” for the commands: State of Colorado Office of Cyber Security
    • Make a call through telnetCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  “gsm call 3031234” : State of Colorado Office of Cyber Security
    • DDMSCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  The Eclipse DDMS can attach to a running emulator (Start Eclipse first), and just explore the files: State of Colorado Office of Cyber Security
    • DDMS callCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Make a call through DDMS, http://developer.android.com/guide/developing/debugging/ddms.html : State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE WebView and WebKit State of Colorado Office of Cyber Security
    • Webkit.WebViewCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Adding items to the Screen Menu http://developer.android.com/resources/faq/commontasks.html#filelist State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE SQLite State of Colorado Office of Cyber Security
    • SQLiteCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Android comes preconfigured with a embedded version of SQLite, http://www.sqlite.org/  There are several GUI tools that can be used to administrate SQLite database, included http://sqliteman.com/ the GUI for SQLite 3.  The database itself can be examined through adb as a remote shell http://developer.android.com/guide/developing/tools/adb.html#sqlite  The Notepad Tutorial , Exercise 1, uses SQLite to store notes http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE Debugging State of Colorado Office of Cyber Security
    • DebuggingCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  Debugging information can be found at http://developer.android.com/guide/developing/debugging/index.html  Android is shipped with the Dalvik Debug Monitor Server (DDMS), which provides port-facing services, screen capture on the device, thread and heap information, logcat, and much more. http://developer.android.com/guide/developing/debugging/ddms.html  Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. http://developer.android.com/guide/developing/tools/adb.html TraceView is a graphical viewer for execution logs that you create using the Debug class to log tracing information in your code. http://developer.android.com/guide/developing/debugging/debugging-tracing State of Colorado Office of Cyber Security
    • DDMSCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  From Eclipse, select Windows->Open Perspective->Other -> DDMS: State of Colorado Office of Cyber Security
    • DDMSCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE ADB State of Colorado Office of Cyber Security
    • ADBCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  The Android Debug Bridge (ADB), http://developer.android.com/guide/developing/tools/adb.html State of Colorado Office of Cyber Security
    • ADB ShellCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  ADB can run a shell into the emulator, or remote device, here’s the databases, “ls –R /data/data/*/databases” : State of Colorado Office of Cyber Security
    • ADB installCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE Installing APK applications, “abd –s emulator-554 install” : State of Colorado Office of Cyber Security
    • CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE Android Notepad Tutorial State of Colorado Office of Cyber Security
    • Android TutorialCYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE HOMELAND SECURITY MULTI-USER NETWORK CYBER SECURITY INFORMATION TECHNOLOGY CRITICAL INFRASTRUCTURE  There is a popular tutorial to walk the programmer through many of the features of Android called the Notepad Tutorial, http://developer.android.com/resources/tutorials/notepad/index.html  State of Colorado Office of Cyber Security