Download Android dev

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
N Amanquah
Application Framework
Views (extensible) -to build an application, including lists,
grids, text boxes, buttons, an embeddable web browser etc
Content Providers allow access to data from other
applications (eg Contacts), or share their own data
Resource Manager, provides access to non-code resources
eg localized strings, graphics, and layout files
Notification Manager enables applications to display custom
alerts in the status bar
Activity Manager manages lifecycle of applications and
provides a common navigation backstack
Another classification
Four types of application components
• activity represents a single screen with a user
• service is a component that runs in the
• content provider manages a shared set of
application data
• broadcast receiver is a component that
responds to system-wide broadcast
Comes with some apps eg sms, email client,
calendar, contacts, maps etc.
Apps are written in Java
Each Android app runs in its own process, (own instance Dalvik virtual machine.). The
Dalvik VM executes files in the Dalvik Executable (.dex) format
Install Android SDK
Download and install SDK starter pkg (eg installer_r10-windows.exe )
Obtain the android platform and other tools tools
• (using Android SDK & AVD Manager)
 Automatically downloads. (Run “android” in tool directory)
 "Android SDK and AVD Manager" available package and right
panel. Find available version and samples package. Select and
• w/o internet connection:
 Visit
 Eg, to download MAC version of android v 2.0:
(note the paths)
 unzip into appropriate folder
 Open "Android SDK and AVD Manager" , refresh packages
• Ref:
Setup & Development
Eclipse preferred.
For netbeans, obtain nbandroid plugin.
Installation options:
• Use update center: Tools->Plugins->Settings tab,
update center
• Alt: download the plugin eg Eg nbandroid-1.3beta
Add Android Platfom after installing the plugins. Go to
ToolsJava Platforms
specify sdk location eg
C:\Program Files\Android\android-sdk
Package name should have two parts separated by a dot. Also select the target
platform (create one using android SDK & AVD manager)
An activity is a single, focused thing that the user
can do
Activities interact with the user, creates a window
Two methods to implement for Activity
• OnCreate(Bundle) is where you initialize your activity. eg
defining your UI, and use findViewById(int) to
programatically retrieve widgets in UI .
• onPause() -user leaves activity. commit changes
Start an activity (or give it something new to do)
by passing an Intent to startActivity() or
activities, services, and broadcast receivers—are activated by an
asynchronous message called an intent
Basic Apps
Hello World – (default)
package nna.pkg1;
import android.os.Bundle;
public class MainActivity extends Activity
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState)
Customize View
Change strings in main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
android:text="Hello World, MainActivity"
Localization: strings.xml
<?xml version="1.0" encoding="utf-8"?>
<string name="app_name">MainActivity</string>
Building apps using command line tools
The android manifest file