android components and apps copmonents
TRANSCRIPT
Components of android apps
ANDROID 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 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)
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
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 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
javax.netjavax.sqljavax.xml• Partially Used Packages
java.netjava.langjava.beansjava.awt
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
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.
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 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
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
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