01 07 -android programming basics (cont)

Post on 15-Jan-2015

125 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Hello World Sample

Agenda

Hello World !!!

Interacting with Buttons

Screen Navigation

start Activity For Result

Intents

Activity

Services

Broadcast Receivers

Hello World !!!

1. Create a new Android Project

כ Select File > New > Android Project

2. Fill out the project details

כ Enter HelloWorld for Project Name

כ Select “Create new project in workspace”

כ Enter HelloWorld in App name.

כ Enter com.enlume.HelloWorld in Package Name

כ Enter HelloWorld in Activity name (and yes we want to create an Activity)

5

6

7

8

Interacting with Button

9

Interacting with Buttons

10

11

Screen Navigation

12

13

14

15

16

17

18

Start Activity For Result

20

21

22

23

24

Run hello world

• Select the root of the

project.

• Click in the ‘green play

icon’.

• Pick Android Project

• That will get the emulator

going…

The Android Manifest lists application details<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.my_domain.app.helloactivity">

<application android:label="@string/app_name">

<activity android:name=".HelloActivity">

<intent-filter>

<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>

</intent-filter>

</activity>

</application>

The Android Manifest File

This file must declare all activities, services, broadcast receivers and content

provider of the application.

It must also contain the required permissions for the application. For example if

the application requires network access it must be specified here

It can be thought as the deployment descriptor for an Android application.

The "package" attribute defines the base package for the following Java

elements

"android:versionName" and "android:versionCode" specify the version of your

application.

intent filter registered defines that this activity is started once the application

starts (action android:name="android.intent.action.MAIN").

The category definition (category

android:name="android.intent.category.LAUNCHER" ) defines that this

application is added to the application directory on the Android device.

The "uses-sdk" part defines the minimal SDK version your application is valid

for.

Questions?

top related