android components and apps copmonents

12
Components of android apps ANDROID COMPONENTS

Upload: cshashank1992

Post on 11-May-2017

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: ANDROID COMPONENTS AND APPS COPMONENTS

Components of android apps

ANDROID COMPONENTS

Page 2: ANDROID COMPONENTS AND APPS COPMONENTS

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 applicationc. res: Contains all the resources. 2 impt files are

main.xml (which handles the layout) and strings.xml(which contains all the string constants)

Page 3: ANDROID COMPONENTS AND APPS COPMONENTS

Components Of An Android App

d. gen: Contains the file R.java which contains the mapping for all the resources found in the project. We should never modify it

e. bin: Contains .dex and .apk filesf. 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

Page 4: ANDROID COMPONENTS AND APPS COPMONENTS

Components Of An Android App

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

Page 5: ANDROID COMPONENTS AND APPS COPMONENTS

Java Packages In Android• Android doesn’t make use of all the packages

of JRE. However it uses some fully and some partially.

• Fully Used Packagesjava.iojava.sqljava.mathjava.util.concurrent

java.util.logging

Page 6: ANDROID COMPONENTS AND APPS COPMONENTS

javax.netjavax.sqljavax.xml• Partially Used Packages

java.netjava.langjava.beansjava.awt

Page 7: ANDROID COMPONENTS AND APPS COPMONENTS

The DVM In Detail• Dalvik is Google’s 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

Page 8: ANDROID COMPONENTS AND APPS COPMONENTS

JVM v/s DVM1. DVM can’t interpret java bytecode2. No multiple .class files are executed. Rather a

single .dex file is generated by DVM for execution3. 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.

Page 9: ANDROID COMPONENTS AND APPS COPMONENTS

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.

Page 10: ANDROID COMPONENTS AND APPS COPMONENTS

Major Android Elementsb. 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.

c. Services: Services perform background tasks without providing an UI. They can notify the user via the notification framework in Android

Page 11: ANDROID COMPONENTS AND APPS COPMONENTS

Major Android Elementsd. 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

e. ContentProvider: Allows us to share the data of one application with the other. Like via ContentProvider we can access the Contacts data

Page 12: ANDROID COMPONENTS AND APPS COPMONENTS

Major Android Elementsf. 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