Wednesday, 12 September 2012

Draw a path between two Geo Points

Objective:
Draw a line that between two points on Google Maps lets say City “A” and City “B”. Repeat the process to draw a line between City “B” and City “C”.
What we need:
Coordinates of 3 cities or any 3 locations that we want to connect.
  1. Abbottabad : 34159000,73220000
  2. Islamabad : 33695043,73050000
  3. Rawalpindi :33615043, 73050000
I have taken relative coordinates of 3 Pakistani cities starting from Abbottabad (where my family lives), moving to Islamabad (Capital of Pakistan). From Islamabad moving to Rawalpindi.



  • GeoPoint :An immutable class representing a pair of latitude and longitude, stored as integer numbers of microdegrees
  • Projection :A Projection serves to translate between the coordinate system of x/y on-screen pixel coordinates and that of latitude/longitude points on the surface of the earth.
  • Point :Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that provided this Projection 

    Here is the Screen: 





Monday, 3 September 2012

PopupWindow For Android

A popup window that can be used to display an arbitrary view. The popup windows is a floating container that appears on top of the current activity.Developer site link

Here we are using LayoutInflater for displaying the popupwindow objects. According to our requirements we will create the xml for popupWindow.

Here is the code lines:
LayoutInflater layoutInflater
= (LayoutInflater)getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.popup, null);
final PopupWindow popupWindow = new PopupWindow(
popupView,
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT); 

ScreenShot:

  
 

Wednesday, 25 July 2012

Upload apk into Android Market

Steps for Create a certificate for Android Market apk:

1.If you are using Eclipse for Development just right click on your project and click export.
2.Now choose Android and then Export Android Application. In the next step confirm the project that you want to export.
3.Then click next and now you should be able to select create new keystore.
4.Now fill in the required fields and your should be able to sign your app.
5. Be sure to make a backup of the keystore file and remember your password. Losing this will make it impossible to update your application.
6.If you are using the terminal to create a keystore and you have Java SDK installed there should be a program called keytool in /usr/bin (on a unix based system).
7.On Windows the SDK should also come with the keytool but the install location may be different search for keytool.exe on your computer if keytool is not in your path already. With this tool you should be able to create a key in the following way:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000
8.Remember that once you lose your Certificate or it expires you will not be able to sign your application. Make sure that the expiration date is a long long time in the future. 
Reference sites: Link1
                             Link2
 
Publishing Updates on Android Market :

1.At any time after publishing an application on Android Market, you can upload and publish an update to the same application package.
2.When you publish an update to an application, users who have already installed the application may receive a notification that an update is available for the application. They can then choose to update the application to the latest version.
3.Before uploading the updated application, be sure that you have incremented the android:versionCode and android:versionName attributes in the element of the manifest file. Also, the package name must be the same as the existing version and the .apk file must be signed with the same private key.
Here we need to change:
Go to manifestfile and set the version code like this:
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="your.package.name"
 android:versionCode="2"
 android:versionName="2.0" >
 Here , old versioncode: 1  and new version code:2
4.If the package name and signing certificate do not match those of the existing version, Market will consider it a new application, publish it as such, and will not offer it to existing users as an update.
5.You have to have the same keystore file which you have used to upload the 1st version of application on android market. If you have lost this keystore file then you can't provide update to this application.
Note: Dont forgot to keep a backup of your keystore file.

Refered Links: Click Here







Thursday, 19 July 2012

Android Pdf Reader


This example shows you how to open a pdf file from your activity.
Algorithm:
1.) Create a new project by File-> New -> Android Project name it PDFReader.
2.) You will see some default code into your main.xml and android manifest file.
3.) Download and install any adobe reader application from android market.
4.) Write following into main.xml file:

android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_height="wrap_content" android:text="PDFReader" />

5.) Copy any pdf file onto your sdcard.
6.) Make sure to change the name and path of your pdf file in PDFReaderActivity class. In this example I have used “/sdcard/sample.pdf” . You can change the name of your pdf instead of sample.pdf.
7.) Run for output.


Screen Shots: 



Here is Source Code: Download From Here

Wednesday, 18 July 2012

FacebookIntegration into android application

Steps for Facebook Integration in Android:
The Aim of this article is, to get Facebook integration into our Android Application.

1.Apply for a Facebook Application ID (APP_ID):
For this, we need a facebook account to create our own application.This link will help to create a new application in our account.Click Here
In this site, top corner of the right side, we have an option to create an application i.e
Create New App. Just click on that.. It moves to new window, and need to provide application name and namespace.
Next, it moves to the Our application information page. It contains the App ID , App secret ID and some basic Information.
Here is the screen shot: 
2. Include the Facebook APP_ID in your Android Application:
We need to include the APP_ID into our android application.
So far so good, everything is setup on the Facebook front, now it’s time to start coding our Android application.
On the Android front, we’ll use the Facebook Android SDK located at Github: DownLoad Here

The Facebook Android SDK is licensed under the Apache License and is completely 
open source.
The project contains several samples in the examples folder, but the core SDK is located in the facebook folder.

Here is the full source Code:SourceCode

3. Import the sdk into our application:
This sdk , we will import into our sample application for facebook intraction purpose.

This sdk contains 5 java classes, those are manage to intraction of facebook.

4. Our Sample Applicatoin:
Main page:
This page contains the login button. By using this, first we login to our facebook account.
Then after, in our application contains the few implementations to intraction with facebook. Those are:
                                   1. Update Status.
        1. App Requests
        2. Uploaded photos
        3. Get Friends
        4. Current Location
Few Screen Shots in our Application:
After Updating status in FB

Update Status

Login Screen
 
Main Page




Here is the Reference Link: Click Here


Tuesday, 3 July 2012

RSS Reader in Andorid


RSS stands for Really Simple Sydication. It allows you to easily stay informed by retrieving the latest content from the websites you are interested in. These Feeds automatically syndicate the articles in a website and convert them into a standard XML format which can be viewed using software called RSS Feed Reader or Aggregator

 Here, it has few steps:

 

Monday, 2 July 2012

Custom Wheel Widget.

Android provides a DatePicker widget, but not an iPhone-like. The android-wheel project helps in building similar components, with a range of controls.
To build a widget using android-wheel, the project should be checked out from SVN and be referenced as an android library. The google project contains 'wheel' and 'wheel-demo' modules.
Quick Notes On The Widget
Package : kankan.wheel.widget is the base package.
View : WheelView is the View class that creates the wheel.
Listeners : OnWheelChangedListener, OnWheelScrollListener, OnWheelClickedListener support wheel actions like onChanged, onScrollingStarted, onScrollingFinished & onItemClicked.
Adapter(s) :
  • WheelViewAdapter is the adapter interface for the wheel items.
  • NumericWheelAdapter is a concrete implementation to support numeric values.
  • ArrayWheelAdapter<T> is a concrete implementation to support <T>
  • Custom implementations of WheelViewAdapter can be written using AbstractWheelTextAdapter. 

    Screen Shot:  
     

     

ActionBar with Tabs:


The Action Bar is a widget for activities that replaces the traditional title bar at the top of the screen. By default, the Action Bar includes the application logo on the left side, followed by the activity title, and any available items from the Options Menu on the right side.

 
Here is the Source Code:

Screen Shot:


Thursday, 14 June 2012

Custom fonts in Android

Using a .ttf or .otf font in Android is fairly straightforward. Firstly create ‘assets/fonts/’ and put the files in there. Now using Typeface.createFromAsset we can create the typeface.
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/HandmadeTypewriter.ttf");
To set TextView to use this typeface we use the setTypeface function.
TextView tv = (TextView) findViewById(R.id.texty);
tv.setTypeface(tf);
The Typeface class specifies the typeface and intrinsic style of a font. This is used in the paint, along with optionally Paint 
settings like textSize, textSkewX, textScaleX to specify how text appears when drawn (and measured).
Here is our java class:
public class CustomFontsActivity extends Activity {
    /** Called when the activity is first created. */
        
        TextView customStyle1,customStyle2;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Typeface tf1 = Typeface.createFromAsset(getAssets(), "fonts/HandmadeTypewriter.ttf");
        Typeface tf2 = Typeface.createFromAsset(getAssets(), "fonts/MgOpenCosmeticaBold.ttf");
        customStyle1 = (TextView)findViewById(R.id.text);
        customStyle2 = (TextView)findViewById(R.id.text1);
        customStyle1.setTypeface(tf1);
        customStyle2.setTypeface(tf2);
       
    }
}
Here is our main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <TextView
        android:layout_marginTop="50dp"
        android:layout_width="fill_parent"
        android:id="@+id/text"
        android:textSize="25dp"
        android:layout_height="wrap_content"
        android:text="This HandmadeTypewriter style" />
    
    <TextView
        android:layout_marginTop="50dp"
        android:layout_width="fill_parent"
        android:id="@+id/text1"
        android:textSize="20dp"
        android:layout_height="wrap_content"
        android:text="This is MgOpenCosmeticaBold style" />
</LinearLayout>

Here is the Screen Shot:






Questions on Android

What is Android?
Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

Explain the Architecture of android ?
Top -> Applications (Contacts, Browser, Phone, etc)

Below Applications -> Application Framework(Activity Manager, Window Manager, Content Providers, View System, Package manager,
Telephony manager, Resource, Notification, Location managers)

Below Application Framework -> System Libraries(Like Sqlite, webkit, SSL, OpenGL, Media Framework etc) & Android Runtime( Core Libraries and DVM)
Atlast Last -> Linux Kernel (which composed of drivers like display, camera etc.)
Describe the APK format.
The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files.
A project is compiled into a single .apk file.

What is an action?
A description of something that an Intent sender desires.

What is an activity?
A single screen in an application, with supporting Java code.
An activity presents a visual user interface for one focused endeavor the user can undertake.
For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions.
Each one is implemented as a subclass of the Activity base class.

What is a service?
A service doesn’t have a visual user interface, but rather runs in the background for an indefinite period of time.
For example, a service might play background music as the user attends to other matters, or it might fetch data over the network or calculate
something and provide the result to activities that need it.
Each service extends the Service base class.

What is a Broadcast receivers?
A broadcast receiver is a component that does nothing but receive and react to broadcast announcements.
For example, announcements that the timezone has changed, that the battery is low or that the user changed a language preference.
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 like(flashing the backlight, vibrating the device, playing a sound)

What is a content provider?
A content provider makes a specific set of the application’s data available to other applications.The content provider extends the ContentProvider
base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it controls.
However, applications do not call these methods directly. Rather they use a ContentResolver object and call its methods instead.

What is intent?
A class (Intent) describes what a caller desires to do. The caller sends this intent to Android’s intent resolver, which finds the most suitable activity for the intent.

How is nine-patch image different from a regular bitmap?
It is a resizable bitmap resource that can be used for backgrounds or other images on the device. The NinePatch class permits drawing a bitmap in nine sections. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes.

What languages does Android support for application development?
Android applications are written using the Java programming language.

What is a resource?
A user-supplied XML, bitmap, or other file, injected into the application build process, which can later be loaded from code.

What Virtual Machine Android runs on?
Dalvik virtual machine

What are the features of Android?
Components can be reused and replaced by the application framework.
Optimized DVM for mobile devices
SQLite enables to store the data in a structured manner.
Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies
The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE.

Why to use Android?
Android is useful because:
It is simple and powerful SDK
Licensing, Distribution or Development fee is not required
Easy to Import third party Java library
Supporting platforms are – Linux, Mac Os, Windows

Android Glossary

.apk extension
The extension for an Android package file, which typically contains all of the files related to a single Android application. The file itself is a compressed collection of an AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.

.dex extension
Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.

Action
A description of something that an Intent sender wants done. An action is a string value assigned to an Intent. Action strings can be defined by Android or by a third-party developer. For example, android.intent.action.VIEW for a Web URL, or com.example.rumbler.SHAKE_PHONE for a custom application to vibrate the phone.

Activity
A single screen in an application, with supporting Java code, derived from the Activity class.

adb
Android Debug Bridge, a command-line debugging application shipped with the SDK. It provides tools to browse the device, copy tools on the device, and forward ports for debugging.

Application
A collection of one or more activities, services, listeners, and intent receivers. An application has a single manifest, and is compiled into a single .apk file on the device.

Content Provider
A class built on ContentProvider that handles content query strings of a specific format to return data in a specific format.

Content URI
A type of URI.

Dalvik
The name of Android's virtual machine. The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format, a format that is optimized for efficient storage and memory-mappable execution. The virtual machine is register-based, and it can run classes compiled by a Java language compiler that have been transformed into its native format using the included "dx" tool. The VM runs on top of Posix-compliant operating systems, which it relies on for underlying functionality (such as threading and low level memory management). The Dalvik core class library is intended to provide a familiar development base for those used to programming with Java Standard Edition, but it is geared specifically to the needs of a small mobile device.

DDMS
Dalvik Debug Monitor Service, a GUI debugging application shipped with the SDK. It provides screen capture, log dump, and process examination capabilities.

Drawable
A compiled visual resource that can be used as a background, title, or other part of the screen. It is compiled into an android.graphics.drawable subclass.

Intent
A class (Intent) that contains several fields describing what a caller would like to do. The caller sends this intent to Android's intent resolver, which looks through the intent filters of all applications to find the activity most suited to handle this intent. Intent fields include the desired action, a category, a data string, the MIME type of the data, a handling class, and other restrictions.

Intent Filter
Activities and intent receivers include one or more filters in their manifest to describe what kinds of intents or messages they can handle or want to receive. An intent filter lists a set of requirements, such as data type, action requested, and URI format, that the Intent or message must fulfill. For Activities, Android searches for the Activity with the most closely matching valid match between the Intent and the activity filter. For messages, Android will forward a message to all receivers with matching intent filters.

Intent Receiver
An application class that listens for messages broadcast by calling Context.broadcastIntent().

Layout resource
An XML file that describes the layout of an Activity screen.

Manifest
An XML file associated with each Application that describes the various activies, intent filters, services, and other items that it exposes.

Nine-patch / 9-patch / Ninepatch image
A resizeable bitmap resource that can be used for backgrounds or other images on the device.

Resource
A user-supplied XML, bitmap, or other file, entered into an application build process, which can later be loaded from code. Android can accept resources of many types. Application-defined resources should be stored in the
res/ subfolders.
Service
A class that runs in the background to perform various persistent actions, such as playing music or monitoring network activity.

Theme
A set of properties (text size, background color, and so on) bundled together to define various default display settings. Android provides a few standard themes, listed in R.style (starting with "Theme_").

URIs
Android uses URI strings both for requesting data (e.g., a list of contacts) and for requesting actions (e.g., opening a Web page in a browser). Both are valid URI strings, but have different values. All requests for data must start with the string "content://". Action strings are valid URIs that can be handled appropriately by applications on the device; for example, a URI starting with "http://" will be handled by the browser.


What’s the difference between file, class and activity in android?

File – It is a block of arbitrary information, or resource for storing information. It can be of any type.
Class – Its a compiled form of .Java file . Android finally used this .class files to produce an executable apk
Activity – An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view.

What is a Sticky Intent?

sendStickyBroadcast() performs a sendBroadcast (Intent) that is “sticky,” i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver (BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent).
One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action — even with a null BroadcastReceiver — you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.

Does Android support the Bluetooth serial port profile?

Yes.
Can an application be started on powerup?

Yes.
How to Remove Desktop icons and Widgets ?

A. Press and Hold the icon or widget. The phone will vibrate and on the bottom of the phone you will see anoption to remove. While still holding the icon or widget drag it to the remove button. Once remove turns red drop the item and it is gone

Describe a real time scenario where android can be used?

Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you.
With a mobile phone with android, the Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens.

How to select more than one option from list in android xml file?

Give an example.
Specify android id, layout height and width as depicted in the following example.

What languages does Android support for application development?

Android applications are written using the Java programming language.

Describe Android Application Architecture.

Android Application Architecture has the following components:
• Services – like Network Operation
• Intent – To perform inter-communication between activities or services
• Resource Externalization – such as strings and graphics
• Notification signaling users – light, sound, icon, notification, dialog etc.
• Content Providers – They share data between applications

Common Tricky questions

 Remember that the GUI layer doesn’t request data directly from the web; data is always loaded from a local database.
 The service layer periodically updates the local database.
 What is the risk in blocking the Main thread when performing a lengthy operation such as web access or heavy computation? Application_Not_Responding exception will be thrown which will crashandrestarttheapplication.
 Why is List View not recommended to have active components? Clicking on the active text box will pop up the software keyboard but this will resize the list, removing focus from the clicked element.

Open Source
What is the Android Open Source Project?

We use the phrase “Android Open Source Project” or “AOSP” to refer to the people, the processes, and the source code that make up Android.
The people oversee the project and develop the actual source code. The processes refer to the tools and procedures we use to manage the development of the software. The net result is the source code that you can use to build cell phone and other devices.

Why did we open the Android source code?

Google started the Android project in response to our own experiences launching mobile apps. We wanted to make sure that there would always be an open platform available for carriers, OEMs, and developers to use to make their innovative ideas a reality. We also wanted to make sure that there was no central point of failure, so that no single industry player could restrict or control the innovations of any other. The single most important goal of the Android Open-Source Project (AOSP) is to make sure that the open-source Android software is implemented as widely and compatibly as possible, to everyone’s benefit.
You can find more information on this topic at our Project Philosophy page.

What kind of open-source project is Android?

Google oversees the development of the core Android open-source platform, and works to create robust developer and user communities. For the most part the Android source code is licensed under the permissive Apache Software License 2.0, rather than a “copyleft” license. The main reason for this is because our most important goal is widespread adoption of the software, and we believe that the ASL2.0 license best achieves that goal.
You can find more information on this topic at our Project Philosophy and Licensing pages.

Why is Google in charge of Android?

Launching a software platform is complex. Openness is vital to the long-term success of a platform, since openness is required to attract investment from developers and ensure a level playing field. However, the platform itself must also be a compelling product to end users.
That’s why Google has committed the professional engineering resources necessary to ensure that Android is a fully competitive software platform. Google treats the Android project as a full-scale product development operation, and strikes the business deals necessary to make sure that great devices running Android actually make it to market.
By making sure that Android is a success with end users, we help ensure the vitality of Android as a platform, and as an open-source project. After all, who wants the source code to an unsuccessful product?
Google’s goal is to ensure a successful ecosystem around Android, but no one is required to participate, of course. We opened the Android source code so anyone can modify and distribute the software to meet their own needs.

What is Google’s overall strategy for Android product development?

We focus on releasing great devices into a competitive marketplace, and then incorporate the innovations and enhancements we made into the core platform, as the next version.
In practice, this means that the Android engineering team typically focuses on a small number of “flagship” devices, and develops the next version of the Android software to support those product launches. These flagship devices absorb much of the product risk and blaze a trail for the broad OEM community, who follow up with many more devices that take advantage of the new features. In this way, we make sure that the Android platform evolves according to the actual needs of real-world devices.

How is the Android software developed?

Each platform version of Android (such as 1.5, 1.6, and so on) has a corresponding branch in the open-source tree. At any given moment, the most recent such branch will be considered the “current stable” branch version. This current stable branch is the one that manufacturers port to their devices. This branch is kept suitable for release at all times.
Simultaneously, there is also a “current experimental” branch, which is where speculative contributions, such as large next-generation features, are developed. Bug fixes and other contributions can be included in the current stable branch from the experimental branch as appropriate.
Finally, Google works on the next version of the Android platform in tandem with developing a flagship device. This branch pulls in changes from the experimental and stable branches as appropriate.
You can find more information on this topic at our Branches and Releases.

What is a Sticky Intent?

sendStickyBroadcast() performs a sendBroadcast(Intent) known as sticky, i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action -- even with a null BroadcastReceiver -- you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery
.
How the nine-patch Image different from a regular bitmap? Alternatively, what is the difference between nine-patch Image vs regular Bitmap Image?

It is one of a resizable bitmap resource which is being used as backgrounds or other images on the device. The NinePatch class allows drawing a bitmap in nine sections. The four corners are unscaled; the middle of the image is scaled in both axes, the four edges are scaled into one axis.

What is a resource?

A user defined JSON, XML, bitmap, or other file, injected into the application build process, which can later be loaded from code.

How will you record a phone call in Android? or How to handle an Audio Stream for a call in Android?

Permission.PROCESS_OUTGOING_CALLS: Will Allow an application to monitor, modify, or abort outgoing calls. So using that permission we can monitor the Phone calls.

Does Android support the Bluetooth serial port profile?

Yes.

Can an application be started on powerup?

Yes.
Why are parts of Android developed in private?

It typically takes over a year to bring a device to market, but of course device manufacturers want to ship the latest software they can. Developers, meanwhile, don’t want to have to constantly track new versions of the platform when writing apps. Both groups experience a tension between shipping products, and not wanting to fall behind.
To address this, some parts of the next version of Android including the core platform APIs are developed in a private branch. These APIs constitute the next version of Android. Our aim is to focus attention on the current stable version of the Android source code, while we create the next version of the platform as driven by flagship Android devices. This allows developers and OEMs to focus on a single version without having to track unfinished future work just to keep up. Other parts of the Android system that aren’t related to application compatibility are developed in the open, however. It’s our intention to move more of these parts to open development over time.








Alert Dialogs



Creating alert dialogs is pretty straight-forward: you can construct an AlertDialog by using its Builder class, whose methods all return an instance of Builder, which basically means you can chain a series of method calls together.

  1. new AlertDialog.Builder(AlertDialougesActivity.this).setTitle("Test Dialog").setMessage("This is just for Testing..!").setNeutralButton("Close", null).show();
Would produce this alert: 

 

Here we are accessing AlertDialog’s static Builder class and handing it the context where the dialog will be displayed. setNeutralButton(String, OnClickListener) creates a button with the specified title and OnClickListener to handle anything that should happen on a click. You can simply give it a value of null because AlertDialog buttons always close when clicked; your OnClickListener would simply handle additional, custom instructions.
We have three types of buttons :

  1. setPositiveButton
    Describes an intended action or a confirmation, e.g. “Save” or “Yes”.
  2. setNeutralButton
    Describes a “neutral” action such as “Close”.
  3. setNegativeButton
    Describes a cancellation or simply a “No”.
It’s important to note that if you add all three of these buttons, they will be in the same order as the list above, so sometimes you might have to switch “neutral” and “negative” to achieve a desired order. So, the following snippet:

new AlertDialog.Builder(AlertDialougesActivity.this).setTitle("Test Dialog").setMessage("This is just for Testing..!").setNegativeButton("Cancel", null).setPositiveButton("OK", null).setNeutralButton("No", null).show();
Would produce this alert: 

 
And always remember to create at least one button so your dialog can be closed, otherwise you’ll have frustrated users seeing this:
Finally, another popular method is setIcon(int resourceId). It should be self-explanatory:
new AlertDialog.Builder(AlertDialougesActivity.this).setTitle("Test Dialog").setMessage("This is just for Testing..!").setIcon(R.drawable.ic_launcher).setNeutralButton("Close", null).show();
Would produce this alert: 

 









Sunday, 3 June 2012

Android Histrory

     What is this Android actually? Android is a software cluster for mobile devices that includes an operating system OS, key applications and middleware. The Android SDK provides the tools and APIs required to begin developing applications on the Android platform using the Java programming language. About the design, Kernal of Android is based on Linux kernal and further furnished by Google. Android doesn’t have a essential X Window System nor does it support the full set of standard GNU libraries, which makes it difficult to port existing Linux applications or libraries to Android.

Android Incorporation was founded in Palo Alto, California, United States in October, 2003 by Andy Rubin : co-founder of Danger (Danger Incorporation was a company exclusively in platforms, software, design, and services for mobile computing devices), Rich Miner : co-founder of Wildfire Communications, Incorporation, Nick Sears : once VP at T-Mobile, and Chris White : headed design and interface development at Web TV. From starting Android Incorporation operated secretly, expose only that it was working on mobile software’s. On that same year, Rubin had some sort of financial problems and Steve Perlman gave him $10,000 cash in an envelope and refused a stake in Android Incorporation.

Google took over Android Incorporation in August 2005, making Android Incorporation a entire owned property of Google Incorporation main employees of Android Incorporation, including Andy Rubin, Rich Miner and Chris White, stayed at the company after the possession of Google. Not much was known about Android Incorporation at the time of the acquisition, but people conclude that Google was planning to penetrate the mobile phone market with their weapon i.e Android.

After that on 12, November 2007 Android beta SDK was released. Many of you thinking what is SDK? its a Software Development Kit which gives you platform to make new applications, games and other softwares. With proper knowledge you can make any application according to your will.
On 23 September, 2008 the first Android device is launched, that is HTC Dream G1 which operates
Android 1.0,and after that android shows 1.1 update which was released for T-Mobile G1 only.
On November 5, 2007, the Open Handset Alliance, a bunch of several companies which include Broadcom Corporation, Google, HTC, Intel, LG, Marvell Technology Group, Motorola, Nvidia, Qualcomm, Samsung Electronics, Sprint Nextel, T-Mobile and Texas Instruments expose themselves in front of media itself. The aim of the Open Handset Alliance is to develop open standards for mobile devices. On the same day, the Open Handset Alliance also unveiled their first product, Android, a mobile device platform which is built on the Linux kernel (version 2.6).
On 9 December, 2008 14 new members accompany, including ARM Holdings, Asustek Computer Inc, Garmin Ltd, Huawei Technologies, PacketVideo, Atheros Communications, Vodafone, Sony Ericsson, Toshiba Corp.

Version history

Android has been updated frequently since the original release of "Astro", with each fixing bugs and adding new features. Each version is named in alphabetical order, with 1.5 "Cupcake" being the first named after a dessert and every update since following this naming convention.
Recent releases
  • 2.3 Gingerbread refined the user interface, improved the soft keyboard and copy/paste features, better native code support (which improves gaming performance), added SIP support (VoIP calls), and added support for Near Field Communication.
  • 3.0 Honeycomb was a tablet-oriented release which supports larger screen devices and introduces many new user interface features, support for multi-core processors, hardware acceleration for graphics and full system encryption. The first device featuring this version, the Motorola Xoom tablet, went on sale in February 2011.
. 3.1 Honeycomb, released in May 2011, added support for extra input devices, USB host mode for transferring information directly from cameras and other devices, and the Google Movies and Books apps.
  • 3.2 Honeycomb, released in July 2011, added optimization for a broader range of screen sizes, new "zoom-to-fill" screen compatibility mode, loading media files directly from SD card, and an extended screen support API. Huawei MediaPad is the first 7 inch tablet to use this version
  • 4.0 Ice Cream Sandwich, announced on October 19, 2011, brought Honeycomb features to smartphones and added new features including facial recognition unlock, network data usage monitoring and control, unified social networking contacts, photography enhancements, offline email searching, app folders, and information sharing using NFC. Android 4.0.4 is the latest Android version that is available to phones. The source code of Android 4.0.1 was released on November 14, 2011.