Monday, 4 February 2013




HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN ANDROID CREATED BY NAVEENRAJU



ANDROID BASICS EXPLINATIONS BY NAVEENRAJU


 Android Basic

  • Applying Styles and Themes
  • Resources and Assets
  • Database - SQlite DB
  • Creating an Android Project
  • Running Your Application
  • Creating an AVD
  • Creating a Run Configuration




Application fundamentals:


Application fundamentals:


Android applications are written in the Java programming language. The Android SDK tools compile the code—along with any data and resource files. All Code resides in a single file that is apk file (android package file).apk file is use to install the app on device .
Each Android application lives in its own world.
The Android operating system is a multi-user Linux system in which each application is a different user.
By default, every application runs in its own Linux process. Android starts the process when any of the application’s code needs to be executed, and shuts down the process when it’s no longer needed and system resources are required by other applications.
Each process has its own Java virtual machine (VM), so application code runs in isolation from the code of all other applications.
By default, each application is assigned a unique Linux user ID. Permissions are set so that the application’s files are visible only that user, only to the application itself — although there are ways to export them to other applications as well.


Application Components



Application components are the essential building blocks of an Android application. Each component is a different point through which the system can enter your application.

There are four different types of application components. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed.
Here are the four types of application components:
1) Activities
2) Services
3)Content providers
4)Broadcast receivers

1) Activities:
                       An activity provides a user interface for a single screen in your application. Activities can move into the background and then be resumed with their state restored. An application usually consists of multiple activities that are loosely bound to each other. Typically, one activity in an application is specified as the “main” activity, which is presented to the user when launching the application for the first time. If an application is composed of several screens, it has an activity for each screen. when new activity starts a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack.

A view hierarchy is placed within an activity's window by the Activity.setContentView() method. The content view is the View object at the root of the hierarchy. (See the separate User Interface document for more information on views and the hierarchy.)


<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
    <application . . . >
        <activity android:name="com.example.project.FreneticActivity"
                  android:icon="@drawable/small_pic.png"
                  android:label="@string/freneticLabel" 
                  . . .  >
        </activity>
        . . .
    </application>
</manifest>



2) Services:

                    A service is an Android application component that runs in background and has no visual UI. Services are used to perform the processing parts of your application in the background. While the user is working on the foreground UI, services can be used to handle the processes that need to be done in the background. A service can be started by another Android application component such as an activity or other services and it will continue to run in the background even after the user switches to another application. Thus services are less likely to be destroyed by Android system to free resources, than Activities.
 There are two types of services in Android:

  • Unbound Services: It is a type of service which is not bounded to any components. Once started, it will run in the background even after the component that started the service gets killed.

  •  Bound Services: Its bound to other components and runs only till the component to which it is bounded runs.

Like activities and the other components, services run in the main thread of the application process. So that they won't block other components or the user interface, they often spawn another thread for time-consuming tasks (like music playback). 




3)Content Providers:
                               Content Provider are used to share data among several applications. You can store the data in the file system, an SQLite database, on the web, or any other persistent storage location your application can access. Then through content providers other applications are able to query, access or even modify the data you’ve created, as long as your content provider allows it.


For example, the Android system provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider (such as ContactsContract.Data) to read and write information about a particular person.
Content providers are also useful for reading and writing data that is private to your application and not shared. For example, the Note Pad sample application uses a content provider to save notes.
A content provider is implemented as a subclass of ContentProvider and must implement a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.

4)Broadcast receivers:
                                     A broadcast receiver is a component that does nothing but receive and react to broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured and other applications can receive by using Broadcast receiver.


An application can have any number of broadcast receivers to respond to any announcements it considers important. All receivers extend the BroadcastReceiver base class.
Broadcast receivers do not display a user interface. However, they may start an activity in response to the information they receive, or they may use the NotificationManager to alert the user. Notifications can get the user's attention in various ways — flashing the backlight, vibrating the device, playing a sound, and so on. They typically place a persistent icon in the status bar, which users can open to get the message.


Activating Components:

                                        Intents: Intents are the activating components. The components — activities, services, and broadcast receivers — are activated by asynchronous messages called intents. An intent is an object that holds the content of the message. There are two types of Intents in Android:
  • Explicit Intents: Explicit intents designate the target component by its name.In explicit Intent, We specify which activity should get active on receiving the intent. These are usually used for application’s internal communications.
  • Implicit Intents: In implicit Intent we are sending a message to the Android system to find a suitable Activity that can respond to the intent. Implicit intents are often used to activate components in other applications.

<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
    <application . . . >
        <activity android:name="com.example.project.FreneticActivity"
                  android:icon="@drawable/small_pic.png"
                  android:label="@string/freneticLabel" 
                  . . .  >
            <intent-filter . . . >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter . . . >
                <action android:name="com.example.project.BOUNCE" />
                <data android:mimeType="image/jpeg" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        . . .
    </application>
</manifest>


For broadcast receivers, the intent simply defines the announcement being broadcast (for example, a broadcast to indicate the device battery is low includes only a known action string that indicates "battery is low").
The other component type, content provider, is not activated by intents. Rather, it is activated when targeted by a request from a ContentResolver. The content resolver handles all direct transactions with the content provider so that the component that's performing transactions with the provider doesn't need to and instead calls methods on the ContentResolver object. This leaves a layer of abstraction between the content provider and the component requesting information (for security).
There are separate methods for activating each type of component:
For more information about using intents, see the Intents and Intent Filters document. More information about activating specific components is also provided in the following documents: ActivitiesServices,BroadcastReceiver and Content Providers.

The Manifest File:
                            Every application must have an AndroidManifest.xml file in its root directory.AndroidManifest.xml is a powerful file in the Android platform that allows you to describe the functionality and requirements of your application to Android. The manifest is a structured XML file and is always named AndroidManifest.xml for all applications. It does a number of things:
  • Informing the Android about the application’s components.
  • Declaring the application’s components, such as naming any libraries the application needs to be linked against.
  • Declare the hardware and software features used or required by the application.
  • Declare the minimum API Level required by application
  • Identify any user  permission the application expects to be granted
Please ensure the manifest is packaged with your app and includes the following elements and data:
  • Version Name
  • Uses- sdk
  • Uses-configuration
  • Uses-feature
  • Supports-screens

<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
    <application . . . >
        <activity android:name="com.example.project.FreneticActivity"
                  android:icon="@drawable/small_pic.png"
                  android:label="@string/freneticLabel" 
                  . . .  >
        </activity>
        . . .
    </application>
</manifest>

In the <application> element, the android:icon attribute points to resources for an icon that identifies the application.
In the <activity> element, the android:name attribute specifies the fully qualified class name of theActivity subclass and the android:label attributes specifies a string to use as the user-visible label for the activity.
You must declare all application components this way:
Activities, services, and content providers that you include in your source but do not declare in the manifest are not visible to the system and, consequently, can never run. However, broadcast receivers can be either declared in the manifest or created dynamically in code (as BroadcastReceiver objects) and registered with the system by calling registerReceiver().
For more about how to structure the manifest file for your application, see the The AndroidManifest.xml Filedocumentation.



Sunday, 3 February 2013





HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN ANDROID CREATED BY NAVEENRAJU



ANDROID BASICS EXPLINATIONS BY NAVEENRAJU


 Android Basic

  • Applying Styles and Themes
  • Resources and Assets
  • Database - SQlite DB
  • Creating an Android Project
  • Running Your Application
  • Creating an AVD
  • Creating a Run Configuration




Android Architecture:


android architecture:


Being an Android user you may know how the basic functions such as making a call, sending a text message, changing the system settings, install or uninstall apps etc. Well! All Android users know these, but not enough for a developer. Then what else details are a developer required to know about Android, I’ll explain. To be a developer, you should know all the key concepts of Android. That is, you should know all the nuts and bolts of Android OS.
Here we start:

Android Architecture Diagram:

Android architecture- Diagram
The above figure shows the diagram of Android Architecture. The Android OS can be referred to as a software stack of different layers, where each layer is a group of sveral  program components. Together it includes operating system, middleware and important applications. Each layer in the architecture provides different services to the layer just above it. We will examine the features of each layer in detail.

Linux Kernel

The basic layer is the Linux kernel. The whole Android OS is built on top of the Linux 2.6 Kernel with some further architectural changes made by Google.  It is this Linux that interacts with the hardware and contains all the essential hardware drivers. Drivers are programs that control and communicate with the hardware. For example, consider the Bluetooth function. All devices has a Bluetooth hardware in it. Therefore the kernel must include a Bluetooth driver to communicate with the Bluetooth hardware.  The Linux kernel also  acts as an abstraction layer between the hardware and other software layers. Android uses the Linux for all its core functionality such as Memory management, process management, networking, security settings etc. As the Android is built on a most popular and proven foundation, it made the porting of Android to variety of hardware, a relatively painless task.

Libraries

The next layer is the Android’s native libraries. It is this layer that enables the device to handle different types of data. These libraries are written in c or c++ language and are specific for a particular hardware.
Some of the important native libraries include the following:
Surface Manager: It is used for compositing window manager with off-screen buffering. Off-screen buffering means you cant directly draw into the screen, but your drawings go to the off-screen buffer. There it is combined with other drawings and form the final screen the user will see. This off screen buffer is the reason behind the transparency of windows.
Media framework: Media framework provides different media codecs allowing the recording and playback of different media formats
SQLite: SQLite is the database engine used in android for data storage purposes
WebKit: It is the browser engine used to display HTML content
OpenGL: Used to render 2D or 3D graphics content to the screen

Android Runtime

Android Runtime consists of Dalvik Virtual machine and Core Java libraries.
Dalvik Virtual Machine
It is a type of JVM used in android devices to run apps and is optimized for low processing power and low memory environments. Unlike the JVM, the Dalvik Virtual Machine doesn’t run .class files, instead it runs .dex files. .dex files are built from .class file at the time of compilation and provides hifger efficiency in low resource environments. The Dalvik VM allows multiple instance of Virtual machine to be created simultaneously providing security, isolation, memory management and threading support. It is developed by Dan Bornstein of Google.
Core Java Libraries
These are different from Java SE and Java ME libraries. However these libraries provides most of the functionalities defined in the Java SE libraries.

Application Framework

These are the blocks that our applications directly interacts with. These programs manage the basic functions of phone like resource management, voice call management etc. As a developer, you just consider these are some basic tools with which we are building our applications.
Important blocks of Application framework are:
Activity Manager: Manages the activity life cycle of applications
Content Providers: Manage the data sharing between applications
Telephony Manager: Manages all voice calls. We use telephony manager if we want to access voice calls in our application.
Location Manager: Location management, using GPS or cell tower
Resource Manager: Manage the various types of resources we use in our Application

Applications

Applications are the top layer in the Android architecture and this is where our applications are gonna fit. Several standard applications comes pre-installed with every device, such as:
  • SMS client app
  • Dialer
  • Web browser
  • Contact manager
As a developer we are able to write an app which replace any existing system app. That is, you are not limited in accessing any particular feature. You are practically limitless and can whatever you want to do with the android (as long as the users of your app permits it). Thus Android is opening endless opportunities to the developer.







Application lifetime & states:





onCreate() This method is called for initialization and static set up purposes. It may get passed an older state for resuming.

 The next method is always onStart().

onRestart() After an activity is stopped and about to be started again, this hook is called and after it onStart().

onStart() The application process type changes to visible and the activity is about

to be visible to the user, but it’s not in the foreground.

onResume() The activity has the focus and can get user input. The application

process type is set to foreground.

onPause() If the application loses the focus or the device is going to sleep, this

hook is called and the process type is set to visible. After running this hook,

the system is allowed to kill the application at any time. All CPU consuming

operations should be stopped and unsaved data should be saved. The activity

may be resumed or get stopped.

onStop() The activity is no longer visible, the process type is set to background

and the application may be killed at any time by the system to regain memory.

The activity is either going to get destroyed, or restarted.

onDestroy() The last method that is called in an activity right before the system

kills the application or the application deletes the activity. The application

process may be set to empty if the system keeps the process for caching

purposes.





HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN ANDROID CREATED BY NAVEENRAJU



ANDROID BASICS EXPLINATIONS BY NAVEENRAJU


 Android Basic

  • Applying Styles and Themes
  • Resources and Assets
  • Database - SQlite DB
  • Creating an Android Project
  • Running Your Application
  • Creating an AVD
  • Creating a Run Configuration




installation


NSTLLATION ADT BUNDLE IN MAC OS:


requires java(jdk6.0) or grater versions,then go throw that process in this video

i mentioned below








NSTLLATION OF ANDROID IN WINDOWS:


                                       



NSTLLATION OF ANDROID IN LINEX (UBENTU):

                                      


I






HI THIS TOUTORIAL WILL HELP FULL FOR STARTUP IN ANDROID CREATED BY NAVEENRAJU



ANDROID BASICS EXPLINATIONS BY NAVEENRAJU


 Android Basic

  • Applying Styles and Themes
  • Resources and Assets
  • Database - SQlite DB
  • Creating an Android Project
  • Running Your Application
  • Creating an AVD
  • Creating a Run Configuration







INTRODUCTION TO ANDROID


INTRODUCTION TO ANDROID:

What is android ? 

This is a simple question but the answer is quite complicated. If you go deeper on the word android , You will get lot of answers for the question What is Android. To answer in a simple way. Android is an operating system for Mobile phones. I will explain more about this in the later part of this article.
Lot of advances can be seen these days in the field of smartphones. As the number of users is increasing day by day, facilities are also increasing. Starting with simple phones which were made just to make and receive calls. Now we have phones which can even access GPS , GPRS, Wifi, NFC. and lot of other cool and advanced features which you cannot even imagine.
So in this Mobile world of this complication. Android is one of those operating system platforms which made it easy for manufacturers to design top class phones.
You might have seen windows , linux and mac operating systems which are made for computers. Windows is the most popular operating system on computers. So if you know about it then it is easy for you to get an answer for 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.



You can see the logo of Android from the image below:
what is 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.
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.)


Android (operating system)


Android is a Linux-based operating system designed primarily for touchscreen mobile devices such as smartphones and tablet computers. Initially developed by Android, Inc., which Google backed financially and later purchased in 2005,[9] Android was unveiled in 2007 along with the founding of the Open Handset Alliance: a consortium of hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices.[10] The first Android-powered phone was sold in October 2008.[11]Android is open source and Google releases the code under the Apache License.[12] This open source code and permissive licensing allows the software to be freely modified and distributed by device manufacturers, wireless carriers and enthusiast developers. Additionally, Android has a large community of developers writing applications ("apps") that extend the functionality of devices, written primarily in a customized version of the Java programming language.[13] In October 2012, there were approximately 700,000 apps available for Android, and the estimated number of applications downloaded from Google Play, Android's primary app store, was 25 billion.[14][15]These factors have allowed Android to become the world's most widely used smartphone platform[16] and the software of choice for technology companies who require a low-cost, customizable, lightweight operating system for high tech devices without developing one from scratch.[17] As a result, despite being primarily designed for phones and tablets, it has seen additional applications on televisions,games consoles and other electronics. Android's open nature has further encouraged a large community of developers and enthusiasts to use the open source code as a foundation for community-driven projects, which add new features for advanced users[18] or bring Android to devices which were officially released running other operating systems.Android had a worldwide smartphone market share of 75% during the third quarter of 2012,[19] with 500 million devices activated in total and 1.3 million activations per day.[20][21]



HISTORY OF ANDROID


With Android's breadth of capabilities, it would be easy to confuse it with a desktop operating system. Android is a layered environment built upon a foundation of the Linux kernel, and it includes rich functions. The UI subsystem includes:
  • Windows
  • Views
  • Widgets for displaying common elements such as edit boxes, lists, and drop-down lists

Android includes an embeddable browser built upon WebKit, the same open source browser engine powering the iPhone's Mobile Safari browser.Android boasts a healthy array of connectivity options, including WiFi, Bluetooth, and wireless data over a cellular connection (for example, GPRS, EDGE, and 3G). A popular technique in Android applications is to link to Google Maps to display an address directly within an application. Support for location-based services (such as GPS) and accelerometers is also available in the Android software stack, though not all Android devices are equipped with the required hardware. There is also camera support.Historically, two areas where mobile applications have struggled to keep pace with their desktop counterparts are graphics/media, and data storage methods. Android addresses the graphics challenge with built-in support for 2-D and 3-D graphics, including the OpenGL library. The data-storage burden is eased because the Android platform includes the popular open source SQLite database. Figure 1 shows a simplified view of the Android software layers.


Android software layers
The Android software layers