This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
The Android SDK is available for free in android website , any developer can download this SDK and before going any further in code work we need to make sure we have installed Eclipse properly along with Android plug-in for eclipse which is also known as Android Development Tools or shortly ADT. Android SDK is used for developing applications, and Eclipse is used to write the code for the applications which is a preferred development environment. The link to get android SDK is http://developer.android.com/sdk/index.html.
4.1.1 The application programming Interface:-
The application code work is done using Java for functionality development and XML for UI development. There are many packages that will be used in android SDK , these packages shows the android code supportive depending up on our development , as any Java programmer knows that we need to add some java packages for java coding but for android we also need to add the android package for our application. Now we see the different packages that are present in application development.
4.1.2 Core Packages of Android:-
If anyone who has done java coding before will know that there are many java packages that we use for writing Java code. These are some of the Java packages that are available.
Java.lang:- core java language classes.
Java.io:- input/output capabilities.
Java.net:- Network connection.
Java.util:- utility classes.
Java .text:- text handling utilities.
Java. Match: - Math and number manipulation classes.
Java.net:- Network classes.
As we can see from above java packages we can identify them based on its name starting which is Java, similarly android has its own identity of representation of packages which start with the name called android and these packages are shown bellow.
Android.app:-Android application model access.
Android. Content:-accessing and publishing data in android.
Android.net:- contains the URL class, which is used for accessing various contents.
Android. Graphics:-graphics primitives.
Android.OS:-system level access to android environment
Android. Text:-Text layout.
Android. Telephony: - Telephony capabilities access.
Android. Webkit: - package for browser functionality.
Android. Widget:-package for more UI elements.
Android. Media:-provides access to various audio and video interfaces.
The above are few of the android packages that we use in applications that we develop but there are many more that we need to know all these packages are taken from the android website [http://developer.android.com/reference/packages.html]; depending up on the application uses and the way we want to show the application we use the android packages accordingly.
4.2 Developer Environment: -
Developer environment is very important for any android developer, the person who is following the all the rules in android should also have very clear idea of the environment that they are developing the application. First we see the diagram of a developer environment and later we will see the explanation of each stage in the diagram.
Android Development Tool (plug-in)
Emulator profile configuration and launch.
Process files system and log views.
Eclipse open source IDE.
Fig 2:- Developer Environment.
4.3 Eclipse and Android Emulator:-
Eclipse and android Emulator are available for any android developer for free , but it is necessary to know how the applications in android are done , so before going in to much deeper parts of application development we need to know the tools that we use for developing any android application.
4.3.1 Eclipse Open source IDE: - Eclipse plays a very important role in android application development, because of its rich Java compilations and debugging facilities that it provides it also has very effective ADT (Android Development Tool), by using these we can virtually manage and control all aspects of testing over android applications directly from Eclipse IDE. The key features of Eclipse environment as it pertains in android application development are as follows.
Rich java development environment with java source compilations, auto compilations and integrated javadoc.
Source level Debugging.
Android Emulator profile management and launch.
The Dalvik Debug Monitoring Service (DDMS).
Eclipse supports the concepts of perspectives in which the layout of the screen has related windows and tools, when developing android applications we have access to two different types of perspectives.
Java Perspectives: -
Java perspective is the place where we do our most of the work in developing the android code , the error corrections and compilations of code are done here and the main advantage in eclipse is that the java code is automatically compiled in background and the errors are shown to us as we develop the code , every time the source file is saved it is automatically compiled by Eclipse Java Developer Tools(JDT), if there is an error in the code the error is automatically shown up in the coding process beside the line where the error is present.
Fig: - Java Perspective.
The above image is a screen shot of the java perspective in the android application coding environment, as we can see in the image from left side is the place where we explore our project (project Explorer).In the middle part we can see the place where we code for application. Towards the right we can see the outline of the particular file we are present in which is battery information.java, and in the bottom part we can see the markers, services, data source explorer, snippets, which are used for exploring the errors and warnings in the code. When we observe on the right side corner we can see some other Perspectives that Eclipse provides to a user, but most of the time we use the DDMS perspective in android.
DDMS perspective: -
DDMS perspective stands for the Dalvik Debug Monitoring Service Perspective , this DDMS perspective shows the dashboard like view in to the heart of the running application in android , this DDMS is not present in Eclipse directly , it comes as a Plug-in with android ADT, after the plug-in is installed then we can see the DDMS perspective in Eclipse. Now we see the screenshot of the DDMS perspective.
Fig: - DDMS perspective.
The above image is the screen shot of DDMS perspective in which gives the functionality of the application when it is running i mean when it is in process in android emulator, this DDMS perspective is same for the mobile phone also but there may be some more log cat files added when using a actual mobile device for testing. Logging is very important tool in any software development so that bring the log cat DDMS perspective. This system is gives a proper view of the system architecture, and how the application is working and state of the activities running in the process.
4.3.2 Android Emulator:-
The emulator is very important in Android application development, it gives the virtual view of the functions that are going in the a mobile phone and shows the same representation of the mobile phone screen so that we can compare our app in the same way as if it is working in a mobile phone. But in our case we rarely use android emulator because we have got a mobile device in availability and most of the time we have been testing the application directly on a device, to avoid the future delays in testing in emulator and again testing on a device. But emulator is useful for people who don't have access to a mobile device, and when we test any application directly in a mobile device there are chances of crashing the mobile phone itself so we need to be careful when we are using a device.
Fig: - android emulator.
Then we go to next stage of this developer environment in which we will show how an android application is built in Eclipse.
Building an android application in Eclipse:-
Before going deep into the android development we need to look into how to start an application development in Eclipse and how to move to execute the application on a mobile device. Start a new application is simple in android but the main problem comes in understanding the application process and development files that are automatically created when a new android project is started. Now we see each stage of the application construction in android.
First stage: - Creating a new project in android. This is very important stage where we declare the name of the project and select which android version that the application should be developed. The following image shows the selection of Build target that the project should be developed. As we can see that build targets are those OS versions of android that the project can be developed. The important point that we need to consider here is the way we select the build target. If we select the higher version of build target for example Android 2.2 and want to test it in android 1.5, then the application may not run some times, but in some cases it gives only partial response in the app, this failure can be based on the work that we are doing in the application development because the newer version we go the newer the API's we get so this depend up on the application development. But we select the build target to be older version and test it in the newer version then it definitely works.
C:\Users\abhi\Desktop\naming the application.png
Fig: - First stage of application starting.
Second stage: - We need to understand the files that are already created in eclipse, when we create a new project; the project file has lots of inner files in it which are explained as follows. The following image shows the project explorer screen where we can see all the project files are present the explanation of this image is shown next to image for better understanding.
Manifest file, the functionalities are explained in chapter 2.
Layout design files are shown here.
These are the files that are developed by android compiler based on our source files; in any case we should not modify these files.
Source files of the application the source files are created by a developer, we write the java code in these files.
Fig: - Files in android application.
As we can see the project name that we have created is at the top of the project explorer and the next we see the source files (src) these are the files that we develop in any application in android, all the java code and the functionality of a application lies in these files. Next comes the generated java files (gen) these files are generated by android java compiler and in any case we should not change these files code. The next comes the Google API's that are created already when a application project is designed , but when a particular API is used in our code the android compiler writes down its own code work accordingly in the API's we have used. The resource folder (res) has all the drawable images and user information in it this folder consists of layout folder where we code the XML code for user interface development and the values file will have the strings declaration in it. The final file is the manifest.xml file we know the functionality of this file from chapter 2.
Debugging: - The debug console that we see in the following figure is from eclipse , as we can see if we observe at the bottom of the figure we see the Tasks and Log cat running simultaneously in the eclipse, the tasks are the activities that we are executing in the applications and each generated method in the tasks shows the functionality of the particular task in that Activity of the file , the log cat are the dalvik virtual machine log massages which shows the time take by the dalvik virtual machine to execute particular part of the activity or method in a application, this log cat also show the file process and the processing of the application in the mobile phone when a developer is using the device when connected to the system.
Fig: - Debug window.
After we debug the code which we have written, it is the compiled using the android ADT but we need to know how the application is built from eclipse IDE and to android compiler and the final result is seen in the Emulator or Mobile device, this process is the build process of an application that is being running in android.
Building the application:-
To this point we know how to use the Eclipse IDE to write the code and by using Android development tool plug-in we run the app in an emulator or a device, but now we look in much deeper that what happens after the compilation step, we need not perform all the steps after compilation the android ADT handles these steps for us, but it is very helpful for us sometimes when we don't know where we are facing the errors in Eclipse as we know that java code will run in java compilers but in android application code work the java code which we have written will be processed in Android Dalvik virtual machine , so this means the java byte code that is created by Eclipse compiler will be converted to the .dex file format which is a dalvik virtual machine file format. The android SDK contains the tools that convert the application files in to the android emulator compatibility and test all the files for us transparently. The files that are converted from one form to another and this conversion of stages are shown in a form of a diagram.
Fig: - converting source files to a package to run in emulator.
The layout file that is developed in XML format in android is processed by (AAPT) and this is converted in to R.java file, we need to remember that to refer R.class file to user interface identifiers when connecting our code with user interface. Java source files are first compiled to class files by the java environment in eclipse, when they are compiled they are converted to .dex file which is the dalvik virtual machine executable file for the app which we have developed. The project files are always converted to binary files then they are processed to the device or emulator where they are extracted to .XML extension, the compiled form of the non-layout resources that include the drawables and the layout values and the .dex file are formed in a package and this package is called as .apk file with its project name like (mobile details.apk). This is the final file that any application creates and this is the only file that any user gets to use the application in there android devices when downloading from android market.
Data base is designed basically from the MY SQL server scripting, but there are many different types of database services that are available, since this project need to be done in a professional process, a free web hosting service provider site was taken and the whole database and the further design of the websites were developed in this web service provider.