Archive for the ‘Android’ Category

how to run multiple AVD/Emulator instances at the same time

November 27, 2010

In order to run multiple emulator instances first press the button as pointed by the picture in eclipse.

Press this button

now you will have the screen like this

after this select the desired device and press the start button like this


Select and Start desired device

now select other device and then press the start button and repeat this procedure for all the desired you want to run






Send an SMS to the Android Emulator

November 4, 2010

Sending SMS is usefull feature of mobile devices many people have been using this feature to communicate,now how to send an SMS message to an emulator running on your machine, to do so  follow these given below steps:

1. In DDMS, choose the emulator you want a send an SMS to.

2. On the Emulator Control tab, input the Incoming phone number (for example,2365478) in the Telephony Actions section.

3. Select the SMS radio button.

4. Type an SMS message that you want to send.

5. Click the Send button. Now in the emulator,  you  should see an incoming SMS notification.

How to Launch Android Applications on a real Handset

November 3, 2010

Now  you want to load your application onto a real handset,to do this, you need to plug in a handset into your computer, using the USB data cable.

Now follow these steps to correctly launch your application in real handset:

1. In Eclipse, choose Run, Debug Configurations.

2. Double-click DroidDebug Debug Configuration.

3. On the Target tab, set Deployment Target Selection Mode to Manual. You can always change it back to Automatic later, but choosing Manual will force you to choose whether to debug within the emulator (and choose an AVD) or a device, if one is plugged in, whenever you choose to debug.

4. Apply your changes by clicking the Apply button.

5. Click the Debug button within Eclipse.A dialog appears, showing all available configurations for running and debugging your application. All physical devices are listed, as are existing emulators that are running. You can also launch new emulator instances by using other AVDs you have created.

6.Double-click one of the running Android devices. There should be one listed for each handset plugged into the machine, in addition to one for each emulator instance running. If you do not see the handset listed, check your cables and make sure you installed the appropriate drivers.


This picture will help you ,basically this is Eclipse dialog for choosing an application deployment target.

How to create Debug and Run Configurations for Android Project in Eclipse

November 2, 2010

To create the debug and run configuration follow the given below steps:

1. In Eclipse, choose Run, Debug Configurations.

2. Double-click the Android Application item to create a new entry.

3. Choose that new entry, called New_configuration.

4. Change the name of the entry to DroidDebug.

5. Choose the Droid1 project by clicking the Browse button.

6. On the Target tab, check the box next to the AVD you created.

7. Apply your changes by clicking the Apply button.

Now you are done

Managing Android Virtual Devices

November 1, 2010

To run an application in the Android emulator, you must configure an Android Virtual Device (AVD). The AVD profile describes the type of device you want the emulator to simulate, including which Android platform to support. You can specify different screen sizes and orientations, and you can specify whether the emulator has an SD card and, if so, its capacity.


Given Below are the steps for creating a basic AVD:

1. Launch the Android SDK and AVD Manager from within Eclipse by clicking on the little green Android icon on the toolbar. You can also launch the manager by selecting Window, Android SDK and AVD Manager in Eclipse.

2. Click the Virtual Devices menu item on the left menu. The configured AVDs will be displayed as a list.

3. Click the New button to create a new AVD.

4. Choose a name for the AVD

5. Choose a build target. For example, to support Android 2.1, choose the item build target called Android 2.1 – API Level 7 from the drop-down.

6. Choose an SD card capacity, in either kibibytes or mibibytes

(The minimum is 9MiB, but keep in mind that the full size of the SD card is stored on your machine.)

7. Choose a skin. This option controls the different visual looks of the emulator.In this case, go with the default HVGA screen, which will display in portrait mode.

Your project settings should look as shown in Figure below

8. Click the Create AVD button and wait for the operation to complete.

9. Click Finish.


Now you are done with the managing android virtual devices


How to Run and Debug Android Applications

November 1, 2010


To build and debug an Android application, you must first configure your project for debugging. The ADT plug-in facilitates the user to do this entirely within the Eclipse development environment. Specifically, you need to do the following three tasks:

  1. Configure an Android Virtual Device (AVD) for the emulator
  2. Create a debug configuration for your project
  3. Build the Android project and launch the debug configuration


When you have completed each of these tasks, Eclipse will attach its debugger to the Android emulator (or handset), and you are free to debug the application as needed.


Developing Android Applications Without Eclipse

October 29, 2010

Usually eclipse is the preferred development environment for android, but it is not requirement for development. The ADT plug-in for Eclipse provides a convenient entry point for many of the
underlying development tools for creating, debuggin,packaging,and signing Android applications.

Developers who do not want to use Eclipse or require some of the more powerful debugging features not available in the Eclipse ADT plug-in can access these underlying tools directly from the
command line.

Tools such as the following are found in the/tools directory of the Android SDK:

.android—Creates Android project files and manages AVDs.

. aapt (Android Asset Packaging Tool)—Packages Android project files into .apk files for installation on the emulator and handset.

. ddms (Dalvik Debug Monitor Service)—Has a user interface of its own, which resembles the Eclipse DDMS perspective.

.adb (Android Debug Bridge)—Has a command-line interface for interacting with the emulator and
the device.

Components of an Android Application

October 24, 2010

It is very important to understand the components of an android
application because Your Android applications will be built from these four basic component types and these are discussed below:


Activities are pieces of executable code that come and go in time,instantiated by either the user or the operating system and running as long as they are needed. They can interact with the user and request  data or services from otheractivities or services via queries or Intents (discussed in a moment).Most of the executable code you write for Android will execute in the context of an Activity. Activities usually correspond to display screens: each
Activity shows one screen to the user. When it is not actively running, an Activity  can be killed by the operating system to conserve memory.


They are executable pieces of code that usually run in the background from the time of their instantiation until the mobile handset is shut down. They generally don’t expose a user interface.The classic example of a Service is an MP3 player.Your applicationmay need to implement Services to perform background tasks.
Broadcast and Intent Receivers

These respond to requests for service from another application. A
BroadcastReceiver responds to a system-wide announcement of an event. These announcements can come from Android itself (e.g., battery low) or from any program running on the system. An Activity or Service provides other applications with access to its functionality by executing an Intent Receiver, a small piece of
executable codethat responds to requests for data or services from other activities.
The requesting(client) activity issues an Intent, leaving it up to the Android framework to figureout which application should receive and act on it.Intents are one of the key architectural elements in Android that facilitate the creation of new applications from existing applications (mobile mashups). You will use Intents in your application to interact with other applications and services that provide information needed by your application

Content providers

These are created to share data with other activities or services. A
content provideruses a standard interface in the form of a URI to fulfill requests for data from otherapplications that may not even know which content provider they are using. For example, when an application issues a query for Contact data, it addresses thequery to a URI of the form:content://contacts/peopleThe operating system looks to see which applications have registered themselves as content providers for the given URI, and sends the request to the
appropriateapplication (starting the application if it is not already running). If there is morethan one content provider registered for the requested URI, the operating systemasks the user which one he wants to use.

Note: An application doesn’t have to use all of the Android components,
but a well-writtenapplication will make use of the mechanisms provided, rather than
reinventing functionalityor hardcoding references to other applications.


Creating a new Android project

October 20, 2010


Given below is the step by step detailed description of creating a new project in android just open eclipse and follow these steps.


1. Choose File, New, Android Project or click the Android Project creator  icon,

on the Eclipse toolbar.The first time you try to create an Android Project, you might need to choose File,New, Project and then select the Android, Android Project. After you have done this

once, it appears in the Eclipse project types and you can use the method described in Step 1.


2. Choose a project name. In this case, name the project Myactivity.


3. Choose a location for the project. Because this is a new project, select the Create New Project in Workspace radio button. Check the Use Default Location check box.If you prefer to store your project files in another location, simply uncheck the Use Default Location check box and browse to the directory of your choice.

Familiarizing Yourself with Eclipse 11

4. Select a build target for your application. For most applications, you want to select the version of Android most appropriate for the devices used by your target audience and the needs of your application. If you will be using the Google add-ons (for example, Google Maps), be sure to choose the Google APIs version for your target platform. For this example, the Android 2.1 (API

level 7) build target is sufficient.


5. Specify an application name. This name is what users will see. In this case, call the application Droid #1.


6. Specify a package name, following standard package namespace conventions for Java. Because   all code in this book falls under the com.androidbook.* namespace, use the package name com.androidbook.myactivity.


7. Check the Create Activity check box. This will instruct the wizard to create a default launch Activity class for the application. Call your activity Droid Activity.


8. Confirm that the Min SDK Version field is correct. This field will be set to the API level of the build target by default (Android 2.1 is API level 7). If you want to support older versions of the Android SDK, you need to change this field. However, in this case, we can leave it as its default value.


9. Click the Next button.


10. The Android project wizard allows you to create a test project in conjunction with your Android application. For this example, a test project is unnecessary. However, you can always add a test project later by clicking the Android Test Project creator icon, which is to the right of the Android project wizard icon (with the letter a, letter J and letter u: ) on the Eclipse toolbar. Test projects are discussed in detail in Hour 22, “Testing Android Applications.”


11. Click the Finish button.


Note: The Android Project Wizard creates all the required files for an Android application


Android Architecture

October 18, 2010

In order to develop applications in android it is necessary to understand the architecture of android so given below content and image  will help you to understand it’s structure.

Android Architecture


1  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.


2  Application Framework

These frameworks are used to create the applications in Android

By providing an open development platform, Android offers developers the ability to build extremely rich and innovative 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. Developers have full access to the same framework APIs used by the core applications.


3  Libraries

Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below

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

Media Libraries – based on Packet Video’sOpenCORE; 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

SGL – the underlying 2D graphics engine

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

Free Type – bitmap and vector font rendering

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



4  Android Runtime

Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.

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.

The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.


5  Linux Kernel

Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.


%d bloggers like this: