nittemca2015.files.wordpress.com€¦  · Web viewAndroid 4.1 Jelly Bean was released to the...

Preview:

Citation preview

Android versions:

1.1 Android beta

1.2 Android 1.0

1.3 Android 1.1

1.4 Android 1.5 Cupcake

1.5 Android 1.6 Donut

1.6 Android 2.0/2.1 Eclair

1.7 Android 2.2.x Froyo

1.8 Android 2.3.x Gingerbread

1.9 Android 3.x Honeycomb

1.10 Android 4.0.x Ice Cream Sandwich

1.11 Android 4.1/4.2 Jelly Bean

Google announced Android 4.1 (Jelly Bean) at the Google I/O

conference on 27 June 2012. Based on Linux kernel 3.0.31,

Jelly Bean was an incremental update with the primary aim of

improving the functionality and performance of the user

interface. The performance improvement involved "Project

Butter", which uses touch anticipation, triple buffering,

extended vsync timing and a fixed framer rate of 60 fps to

create a fluid and "buttery-smooth" UI.[69] Android 4.1 Jelly

Bean was released to the Android Open Source Project on 9

July 2012,[70] and the Nexus 7 tablet, the first device to run

Jelly Bean, was released on 13 July 2012.[71]

Steps to develop an Android application :

1. Install Android SDK

2. Install ADT Eclipse plugin

3. Create an Android Virtual Device (AVD)

4. Create Android Project with Eclipse (Wizard)

5. Code it…

6. Start it in Android Virtual Device (AVD)

Tools needed:

1. JDK 1.6

2. Eclipse IDE 3.7 , Indigo

3. Android SDK

1. Install Android SDK

In Android SDK installed folder, run “Android SDK manager”,

choose what Android version you want to develop.

2. Install ADT Eclipse plugin

To integrate Android SDK with Eclipse IDE, you need to install

Eclipse ADT plugin.

In Eclipse IDE, select “Help” -> Install New Software…”, and

put below URL :

https://dl-ssl.google.com/android/eclipse/

3. Create an Android Virtual Device (AVD)

In Eclipse, you can access the “Android Virtual Device (AVD)” in

Eclipse toolbar. Click “new” to create a AVD.

Later, Eclipse will deploy the application into this AVD.

4. Create Android Project

In Eclipse, select “File -> New -> Project….”, “Android Project”,

and input your application detail. Eclipse will create all the

necessary Android project files and configuration.

5. Hello World

Locate the generated activity file, and modify a bit to output a

string “Hello World”.

File : HelloWorldActivity.java

package com.mkyong.android;

import android.app.Activity;

import android.os.Bundle;

import android.widget.TextView;

public class HelloWorldActivity extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

TextView text = new TextView(this);

text.setText("Hello World, Android - mkyong.com");

setContentView(text);

}

}

6. Demo

Run it as “Android Application“

Press “Home” button (on right hand side), and you will

noticed that “HelloWorld” application is deployed successfully

on the Android virtual device

AndroidManifestFile.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest

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

d"

package="nitte.edu"

android:versionCode="1"

android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" />

<application

android:icon="@drawable/ic_launcher"

android:label="@string/app_name" >

<activity

android:name=".MyHelloWorldActivity"

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>

Layout:

Main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout

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

d"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

<TextView

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="@string/hello" />

</LinearLayout>

String.xml

<?xml version="1.0" encoding="utf-8"?>

<resources>

<string name="hello">Hello World,

MyHelloWorldActivity!</string>

<string name="app_name">MyHelloWorld</string>

</resources>

R.java

/* AUTO-GENERATED FILE. DO NOT MODIFY.

*

* This class was automatically generated by the

* aapt tool from the resource data it found. It

* should not be modified by hand.

*/

package nitte.edu;

public final class R {

public static final class attr {

}

public static final class drawable {

public static final int ic_launcher=0x7f020000;

}

public static final class layout {

public static final int main=0x7f030000;

}

public static final class string {

public static final int app_name=0x7f040001;

public static final int hello=0x7f040000;

}

}

2)

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest

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

d"

package="edu.nmamit"

android:versionCode="1"

android:versionName="1.0">

<uses-permission

android:name="android.permission.INTERNET"/>

<uses-permission

android:name="android.permission.WRITE_EXTERNAL_STORA

GE"/>

<uses-permission

android:name="android.permission.ACCESS_NETWORK_STAT

E"/>

<uses-permission

android:name="android.permission.READ_PHONE_STATE"/>

<application android:icon="@drawable/icon"

android:label="@string/app_name">

<activity android:name=".HelloWorld"

android:label="@string/app_name">

<intent-filter>

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

<category

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

</intent-filter>

</activity>

<receiver android:process=":remote"

android:name="AlarmReceiver"></receiver>

<service android:name="MusicService"

android:enabled="true"></service>

<service android:process=":remote"

android:name=".SimpleService"

android:enabled="true"></service>

<service android:name=".MyAlarmService" />

<service android:name=".AutomaticStopAlarmService" />

<activity android:name=".CloseActivity"></activity>

<service android:name=".MyIntegrate"></service>

</application>

<uses-sdk android:minSdkVersion="6" />

</manifest>

Layouts:

Main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout

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

d"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

>

<TextView

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="@string/hello"

/>

<DatePicker

android:id="@+id/datePicker1"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

<TimePicker

android:id="@+id/timePicker1"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

<EditText

android:id="@+id/editText1"

android:inputType="number"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="Duration in Minutes" >

<requestFocus />

</EditText>

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Set Alarm" />

</LinearLayout>

CloseActivity.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout

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

d"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

<Button

android:id="@+id/cmdClose"

android:layout_width="289dp"

android:layout_height="wrap_content"

android:text="Stop the song" />

</LinearLayout>

R.java

/* AUTO-GENERATED FILE. DO NOT MODIFY.

*

* This class was automatically generated by the

* aapt tool from the resource data it found. It

* should not be modified by hand.

*/

package edu.nmamit;

public final class R {

public static final class attr {

}

public static final class drawable {

public static final int icon=0x7f020000;

}

public static final class id {

public static final int button1=0x7f060004;

public static final int cmdClose=0x7f060000;

public static final int datePicker1=0x7f060001;

public static final int editText1=0x7f060003;

public static final int timePicker1=0x7f060002;

}

public static final class layout {

public static final int closeactivity=0x7f030000;

public static final int main=0x7f030001;

}

public static final class raw {

public static final int apu=0x7f040000;

}

public static final class string {

public static final int app_name=0x7f050001;

public static final int hello=0x7f050000;

}

}

Recommended