Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared.

Similar presentations


Presentation on theme: "Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared."— 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 Harry Potter J K. Rowling 2005 29.99 Learning XML Erik T. Ray 2003 39.95

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 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

11 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); } <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandroid" android:versionCode="1" android:versionName="1.0"> <activity android:name=".HelloAndroid" android:label="@string/app_name">


Download ppt "Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared."

Similar presentations


Ads by Google