Thursday, 7 June 2012

Development with Android

1)What is Android?


Android System - 


Android is an operating system based on Linux with a Java programming interface.
The Android Software Development Kit provides all necessary tools to develop Android applications. This includes a compiler, debugger and a device emulator and its own virtual machine to run Android programs.
Android applications consist of different components and can re-use components of other applications. 
Android provides a rich user interface library, allows background processing, supports 2D and 3D graphics using the OpenGL libraries , access to the file system and provides an embedded SQLite database.

Android Development Tools-

Google provides the Android Development Tools (ADT) to develop Android applications with Eclipse.
ADT is a set of components (plug-ins) which extend with the Eclipse IDE with Android development capabilities.
ADT provides android device emulator, so that application can be tested on android emulator. 

Android components-

The following gives most important Android components.          -Activity
          -Intents
          -ContentProvider
          -Services
          -BroadcastReceiver
          -Views

Dalvik Virtual Machine-

Dalvik virtual machine (DVM) is optimized visual machine for android platform to run java application.
Every application loads DVM in its own address space.

AndroidManifest.xml-

This XML file contains all the configuration in the application.like all activities,intents,receivers,services etc.
It also contains required Permissions.
The <application>  inside the AndroidManifest.xml defines the Project as an application.
The tag <activity> defines an Activity.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ucrules.androidmanifest"
    android:versionCode="1"
    android:versionName="1.0" >
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".FirstActivity"
            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>
 <uses-sdk android:minSdkVersion="9" />
 <uses-permission android:name="android.permission.INTERNET"/>
</manifest>


Security and permissions-

Android System will create a unique user and group ID for every android application.
Each application is private to generated user.
Android also contains a permission system. Android predefines permissions for applications certain tasks.
Android application declares permissions in its AndroidManifest.xml configuration file.

R.java and Resources-

It stands for generated java files for all the resources.
R.java (Resource) will be created to reference all the resources from java code.
R.java is automatically created & will be updated automatically when a need resource is added.
NOTE:-(Do Not Modify R.java Manually)


Activities and Lifecycle-

The Android system controls the lifecycle of your application. At any time the Android system may stop or destroy your application.
-Resume - Activity is foreground - onResume();
-Pause - Activity is in paused state - onPause();
-Stop - Activity is in stopped state  - onStop();


DDMS - (Dalvik Debugging Monitoring System)
It is used to monitor all the activities tasks,heap memory etc.
It provides Logcat which can log message for Android.

5554 is the First Starting code of Android Emulator , which runs on telnet server.