You are on page 1of 12

Android Application Components

Components Of An Android App


There are various folders and files that make up an Android App. Following is their description: a. src: Contains .java files. b. Android<version>: Contains a file called android.jar which all the .jar files needed for any application c. res: Contains all the resources. 2 impt files are main.xml (which handles the layout) and strings.xml(which contains all the string constants)

Components Of An Android App


d.

e. f.

gen: Contains the file R.java which contains the mapping for all the resources found in the project. We should never modify it bin: Contains .dex and .apk files AndroidManifest.xml: It is the manifest file for our application and contains all the permissions needed by our application like allowing the appn to activate automatically as the phone rings

Components Of An Android App


g.

assets: Contains all the assets needed by the application like text files , databases etc.

Java Packages In Android

Android doesnt make use of all the packages of JRE. However it uses some fully and some partially. Fully Used Packages
java.io java.sql java.math java.util.concurrent
java.util.logging

javax.net javax.sql javax.xml

Partially Used Packages


java.net java.lang java.beans java.awt

The DVM In Detail


Dalvik is Googles own JVM which is in charge of running java based Android apps It has been optimized to run on mobile platforms It has 3 main criteria

It is fast, even on weak CPUs It runs on systems with little memory

It runs in an energy-efficient way

JVM v/s DVM


DVM cant interpret java bytecode 2. No multiple .class files are executed. Rather a single .dex file is generated by DVM for execution 3. JVM is stack based while DVM is register based which results in fewer instruction dispatches and smaller program size Fewer instructions means less CPU cycles and therefore less battery consumption. Smaller program size means less memory consumed at runtime.
1.

Major Android Elements


An Android application can have the following important components: a. Activity: represents the presentation layer of an Android application. A simplified description is that an Activity is the screen which the user sees. An Android application can have several activities and it can be switched between them during runtime of the application.

Major Android Elements


b.

c.

Views: are user interface elements e.g. buttons or text fields. The base class for all Views is android.view.View. They have attributes which can be used to change their appearance and behavior. Services: Services perform background tasks without providing an UI. They can notify the user via the notification framework in Android

Major Android Elements


d.

e.

Receivers: Allows us to code something that can be executed in response to change of the state of the phone like as soon as the phone rings or internet connection is established ContentProvider: Allows us to share the data of one application with the other. Like via ContentProvoder we can access the Contacts data

Major Android Elements


f.

Intents: Allows us to call one Activity from the other as well as call other built in applications like Browser , Phone etc from our application

You might also like