Saturday, 26 January 2013

Working With Button



Screen Shots:


activity_main.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Developed by Shrikant"
        android:textAppearance="?android:attr/textAppearanceSmall" />

     <Button
        android:id="@+id/clickButton"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="Click Me"
        android:layout_gravity="center"
        android:layout_marginTop="50dp"
        android:textSize="20dp"
        />

</LinearLayout> 



MainActivity.java:


package com.shrikant.workingwithbutton;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button clickbtn=(Button)findViewById(R.id.clickButton);
        clickbtn.setOnClickListener(new OnClickListener() {
           
            @Override
            public void onClick(View arg0) {
                Toast.makeText(getApplicationContext(), "Button is clicked", Toast.LENGTH_SHORT).show();
             
            }
        });
    }
  }

 

Android Development Tools


Before we start a new project , let us know our tools.
The Android SDK includes several tools and utilities to help us create , test , and debug our projects.

ADT plug-in incorporates most of tools into the Eclipse IDE , where you can access them from DDMS perspective , including:

  • Android SDK and Virtual Device Manager
used to create and manage Android Virtual Devices (AVD) and SDK packages. The AVD hosts an emulator running a
particular build of Android, letting you specify the supported SDK version , Screen resolution , SD card storage etc.
So, you might have several AVDs for different set of hardware.
  • Android Emulator
implementation of the Android virtual machine to designed to run within a virtual device on our development computer.
  • Dalvik Debug Monitoring Service (DDMS)
Use DDMS to monitor and control the Dalvik virtual machines on which we are debugging our applications. And Screen
capturing ,thread and heap information , and logcat information.
  • Android Asset Packaging Tool (AAPT)
     
Constructs the distributable Android package files.
  • Android Debug Bridge (ADB)
A client-server application that provides a link to a running emulator . It lets us copy files, install compiled application
package (.apk) and run shell commands.

Android Architecture

Android Architecture: The following diagram shows the major components of the Android operating system. 



1. Linux Kernel:-   Linux version provides more security, memory management, process management, network stack, and driver model. The kernel is also part the OS that  acts as an abstraction layer between the hardware and the rest of the software stack.

2.Android Runtime:-
       -
Every Android application runs in its own process, with its own instance of the Dalvik virtual machine.
         - Dalvik has been written so that a device can run multiple VMs efficiently.The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint.
         -The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.
       -
Android includes a set of core libraries that provides most of the functionality.

3. Libraries :- Android includes a set of C/C++ libraries used by various components of the Android system.

 Some of the core libraries are listed below:-

 Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications.

LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view.

3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer.


FreeType - bitmap and vector font rendering.

SQLite -
a powerful and lightweight relational database engine available to all applications.

System C library - a BSD-derived implementation of the standard C system library (libc),tuned for embedded Linux-based devices

4.Application Framework :-

Android provides an open development platform, So Developers have full access to the same framework APIs used by the core applications. Developers are free to take advantage of the device hardware, access location information, run background services, set alarms, add notifications to the status bar, and much, much more.

Underlying all applications is a set of services and systems, including:

 - A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser.
 - Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data
 - A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files
 - A Notification Manager that enables all applications to display custom alerts in the status bar
 - An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack.

5. Applications :-
    Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.

Friday, 25 January 2013

What Is Android ?

Android is also an operating system developed by Google. Basically it was started by some other company which was taken by Google. Google improved the operating system and made it a open source platform. It was widely adapted over the world. As it is open source it is so popular amongst the smartphones.  Android OS can also be used on tablet PCs.
Android is based on linux and offers you a great deal of customization in widgets and over millions of apps. Most of them are free of cost and can be installed on your phone just by clicking on install tab of the respective app in the Google Play Store app. Which comes along with the android Phone.

 

Logo of Android:

You can see the logo of Android from the image below:
what is android

 

 

Which Phone Manufacturer use Android?

  Android is a open source platform which can be used by any phone manufacturers on the world. Unlike other operating systems for mobile phones like iOS ( Operating system by apple for iPhone, iPad and other iDevices.). Symbain is owned by Nokia and it comes only on Nokia Handsets. Android can be used by any manufacturer. So that if the latest research is to be believed over half of the smart phones in usa run on android.
                  Android is one the hottest mobile operating systems available today. Samsung is the Largest Manufacturer of android phones and tablets. LG, HTC, Sony, are other top manufacturers of android phones and tablets. Some local manufacturers like Micromax, Karbon, Hawai, also use android Phones on their portable devices.


What is Android Version?

Android is released in series of Versions. Starting from 1.0 version ( where 2.0, 3.0, …… are latest releases). Google name these versions with some food items like ice cream, jelly bean, sandwich etc. which is one of the specialty of android versions.

Here are some of the Versions released by android.
what is android
    • 1.0 – Android beta.
    •  1.5 – Android Cupcake.
    •  1.6 – Android Donut.
    • 2.0/2.1 – Eclair.
    • 2.2.x – Froyo.
    • 2.3.x – Gingerbread.
    • 3.x – Honeycomb (used mainly for tablets.)
    • 4.0.x – Ice Cream Sandwich (both for phones and tablets.)
   4.1/4.2 – Jelly Bean (both for phones and tablets.)