Ad

Showing posts with label Android SDK. Show all posts
Showing posts with label Android SDK. Show all posts

Tuesday, July 13, 2010

Google launches Android 2.2 SDK

Google launches Android 2.2 SDK - V3.co.uk - formerly vnunet.com

Hmm... a new version of the SDk is out! The article above highlights one of the features - the ability to move applications to SD Card thus giving more space for mote applications to be accommodated on an Android mobile.
This is a minor release and yet there are quite a few noteworthy features, some of them listed below:
1. Multiple keyboard languages - a user can switch between languages by swiping across the spacebar
2. The android mobile can be used as a protable Wi-Fi hotspot from which 8 devices can connect.
3. The camera and gallery have been enhanced with a new UI for controlling zoom, focus, flash, exposure etc.
4. Some of the new platform technologies introduced are a new media framework - Stagefright and bluetooth enhancements
5. For the developers. there are some new APIs introduced in Apps on external storage, Media framework, Camera and camcorder, graphics, data backup, device policy manager and UI framework.

For more details on the above, read the article: Android 2.2 Platform Highlights

Thursday, March 25, 2010

Basic steps for upgrading source code from SDK 1.5 to 2.1 using Eclipse IDE

This is a step by step guide to upgrade one’s source code that was developed for an earlier version of android SDK, as is to work on a new version of SDK installed on your development environment



Pre-requisites:
1. You are using Eclipse IDE - Ganymede
2. You have installed SDK 2.1 on your machine
3. You have upgraded ADT to 0.96 on Eclipse IDE
4. You have pointed the Eclipse IDE to the new SDK 2.1
5. You have changed the default JDK compiler version on Eclipse to 1.6
6. You have created an Android Virtual Device (AVD) that uses the SDK 2.1 / Google API


NOTE: Upgrading SDK and Eclipse installations itself is provided in detail at http://developer.android.com/sdk/index.html & http://developer.android.com/sdk/installing.html


For each project that you have in your eclipse workspace that was written for the earlier version of SDK, you need to do the following for basic upgrade (this does not include the upgrade of APIs that have be deprecated):

Step-by-step guide
1. Right click the project and go to Project Properties -> Android
2. You wil see tha right pane showing the ‘Project Build Target’
3. In this pane you will see either or both: ‘Android 2.1’ & ‘Google APIs’ depending on what you chose to install when upgrading your ADT to 0.96
4. Select Google ‘Android 2.1’ or ‘Google API” whichever is required by your earlier project (note you might have used only Android 1.5 for most projects. You would need Google API only for those projects that use google maps)
5. Then, go to the ‘Project’ menu and click on ‘clean’. Note, this is an optional step. You may have to do this if you get the error ‘Conversion to Dalvik format failed with error 1’.
6. Then, build the project by going to ‘Project’ -> ‘build’
7. You are done. You can now run the earlier Android application using the new SDK 2.1


Friday, November 20, 2009

Updating the past tutorials to Android SDK 2.0

Hi Friends,

It has been a couple of weeks since Android SDK 2.0 has been released. Since I have got caught up in many other demanding projects, I have not been able to find any time to update my tutorials' sample code uploaded so far to be compatible to 2.0.
It would be wonderful if, as and when you try my tutorials, you can update / post your comments on deprecated APIs or newer APIs that need to be used.

Thanks.

Hi, I have written a few steps about upgrading to SDK 2.1 at http://saigeethamn.blogspot.com/2010/03/basic-steps-for-upgrading-source-code.html

Sunday, October 4, 2009

Eclipse Set up and New Android Project

The first steps of configuring Eclipse to create android applications and the steps involved in creating a first android project are very well described in this blog at the screencast site. Hence I am not repeating the same here.

Wednesday, August 26, 2009

Implicit Intent | Android Tutorial for Beginners (Part 3)




We have seen in Part 2 how to use Explicit Intents to invoke activities through a very simple example. Now, we will move on to a more interesting concept of Implicit Intents and Intent Filters. 

This requires a little of theoretical understanding before we move on to an example. 

As described earlier, an implicit intent does not name a target component that should act upon the intent. I 
also said that the android platform resolves as to which component is best suited to respond to an Implicit Intent. How does this happen?

Basically, an Intent object has the following information (among other things like Component name, extras and flags) which is of interest for implicit intents:
  • Action
  • Category
  • Data
So, the android platform compares these 3 (action, category and data) to something called "Intent Filters" that are declared by probable target components who are willing to accept Implicit Intent calls.
i.e. Intent Filters are the way of any component to advertise its own capabilities to the Android system. This is done declaratively in the AndroidManifest.xml file.

So here are some important points to remember:
  1. Implicit Intents do not specify a target component
  2. Components willing to receive implicit intents have to declare their ability to handle a specific intent by declaring intent filters
  3. A component can declare any number of Intent Filters
  4. There can be more than one component that declares the same Intent Filters and hence can respond to the same implicit intent. In that case the user is presented both the component options and he can choose which one he wants to continue with
  5. You can set priorities for the intent filters to ensure the order of responses.
There are 3 tests conducted in order to match an intent with intent filters:
  1. Action Test
  2. Category Test
  3. Data Test
For more details about them, you may visit the Android developer documentation here.

Finally we shall look at declaring an implicit intent in one activity which will invoke one of the native activities of the platform by matching the intent filters declared by the same.

The complete code for a very simple implicit intent example that has been described in this article is available for download here.

The InvokeImplicitIntent Activity creates an implicit intent object "contacts". This intent object's component is not set. However, the action is set to "android.content.intent.ACTION_VIEW" and the data's URI is set to "People.CONTENT_URI". 

Such an intent matches with the intent filter declared by the view contacts native activity.
So, when you run this application, it displays the native UI for viewing the existing contacts on the phone!

Here is the relevant piece of code for the same:
           Button viewContacts = (Button)findViewById(R.id.ViewContacts);
        
            viewContacts.setOnClickListener(new OnClickListener() {
            
             public void onClick(View v) {
              Intent contacts = new Intent();
              contacts.setAction(android.content.Intent.ACTION_VIEW);
              contacts.setData(People.CONTENT_URI);
              startActivity(contacts);
             }
            });


In this manner many of the native applications can be seamlessly invoked as one of the activities in our applications through implicit intents.

---------------------------------------------------------------------------------------------------------
Updated on 31st March 2010:
The above example uses Android SDK 1.5.
From SDK 1.6 and above, the Contact.People class has been deprecated and we need to use the ContactsContract class. So the line in code
       contacts.setData(People.CONTENT_URI);

has to be replaced by

       contacts.setData(ContactsContract.Contacts.CONTENT_URI);

Here is the complete source code that has been tested with Android SDK 2.1

Explicit Intent | Android Tutorial for Beginners (Part 2)

Having introduced you to the basic anatomy of an android application in the Part 1 of the series, I would like to show you an example where communication between 2 activities happens through an intent.


However, just one more detail to be introduced as promised and that is -
There are 2 types of intents that Android understands.
1. Explicit Intent
2. Implicit Intent


In an Explicit intent, you actually specify the activity that is required to respond to the intent. In other words, you explicitly designate the target component. This is typically used for application internal messages.


In an Implicit intent (the main power of the android design), you just declare an intent and leave it to the platform to find an activity that can respond to the intent. Here, you do not declare the target component and hence is typically used for activating components of other applications seamlessly
Note: Here for simplicity sake I tell an activity responds to an intent, it could as well be other types of components.
Now I will jump into the example which you can download from here:


This example has 2 activities:
1. InvokingActivity
2. InvokedActivity
The InvokingActivity has a button "Invoke Next Activity" which when clicked explicitly calls the "InvokedActivity" class.
The relevant part of the code is here:

        Button invokingButton = (Button)findViewById(R.id.invokebutton);
        invokingButton.setOnClickListener(new OnClickListener() {
        

        
public void onClick(View v) {
        
Intent explicitIntent = new Intent(InvokingActivity.this,InvokedActivity.class);
         startActivity(explicitIntent);
        
}
        });

As explained in part 1 of the series, this is very much like an API call with compile time binding.
NOTE: The layout for InvokingActivity is defined in main.xml and for InvokedActivity in InvokedActivity.xml. The downloadable example can be opened in Eclipse Ganymede as an android project and can be executed.
In the next part of the series, we will see how to work with implicit intents which also needs us to understand intent-filters

Monday, February 18, 2008

Android - Technically, What Is It?

Android - Technically what is it?
    (an overivew of what is Android and its uniqueness is discussed in another post below)

    1. It is an operating system for mobile
    2. Interestingly, it is not yet another OS, but component based
      OS
    3. It has an integrated Java Virtual Machine
    4. System interfaces are exposed only through Java libraries
    5. It is based on the Linux Kernel
    6. An Android SDK is provided to let developers build applications on top of the OS but not extend the OS itself
    7. The SDK includes

      • Android packages
      • sample files
      • Documentation
      • A Simulator
The offical site of Android broadly classfies the technical parts of the OS as
consisting of
  1. Linux Kernel
  2. Android Runtime
  3. Libraries
  4. Application Framework
over which the core applications run as well as the applications developed by anyone using this framework