1 / 11

Basic, Basic, Basic Android

Basic, Basic, Basic Android. What are Packages?. Page 346 in text Package statement goes before any import statements Indicates that the class declared in the file is part of the specified package. Convention for naming packages Starts with Internet domain in reverse order

Download Presentation

Basic, Basic, Basic Android

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic, Basic, Basic Android

  2. What are Packages? • Page 346 in text • Package statement goes before any import statements • Indicates that the class declared in the file is part of the specified package. • Convention for naming packages • Starts with Internet domain in reverse order • edu.uta.davis.packagename; • Compile the package class • javac –d . FileName.java • Import package into programs • Import edu.uta.davis.packagename;

  3. What is XML? • Extensible Markup Language – set of rules for encoding documents electronically • Helps identify structures in documents • Can invent own tags • Not HTML • HTML tags are fixed – displays data • XML is a meta-language – transport and stores data

  4. <bookstore>  <book category="CHILDREN">    <title>Harry Potter</title>    <author>J K. Rowling</author>    <year>2005</year>    <price>29.99</price>  </book>  <book category="WEB">    <title>Learning XML</title>    <author>Erik T. Ray</author>    <year>2003</year>    <price>39.95</price>  </book></bookstore>

  5. Main Components in Android Application • Activities – building block of user interface; analogous to dialog box or window • Content providers – way to store data on device that is accessible by multiple applications • Services – designed to run indefinitely, independent of any activity (e.g., RSS feed, play back music • Intents – systems messages that can notify applications of various events from hardware state changes to incoming data to application events

  6. Other Features • Storage • Network • Multimedia • Global positioning system • Phone services

  7. What do you need? • Eclipse 3.5 (Galileo) • JDK 5 or JDK 6 • Android SDK starter package • http://developer.android.com/sdk/index.html • Android development tools • Android Virtual Device

  8. What does an Android Project Look Like? • Project contents are in an Android package file (.apk) • Root Directory • AndroidManifest.xml • default.properties • assets • bin • gen • src • res

  9. Root Directory (cont) • AndroidManifest.xml – describes application being built and which components are being supplied by the application • default.properties – used by built script • assets – holds other static files you want packaged with your application • bin – folder that holds compiled code • gen – where Android’s tools will place source code they generate • src - hold Java source code for application • res – holds resources that are packaged with the compiled Java in the application (icons, GUI layouts, etc)

  10. package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello Android"); setContentView(tv); } } <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandroid" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

More Related