1. What is Application?
The Application class in is the base class within an Android app that contains all other components such as activities and services. The Application class, or any subclass of the Application class, is instantiated before any other class when the process for your application/package is created.
2. What is Context?
A Context is a handle to the system; it provides services like resolving resources, obtaining access to databases and preferences, and so on. An app has activities. Context is like a handle to the environment your application is currently running in.
Application Context: This context is tied to the lifecycle of an application. The application context can be used where you need a context whose lifecycle is separate from the current context or when you are passing a context beyond the scope of an activity.
Activity Context: This context is available in an activity. This context is tied to the lifecycle of an activity. The activity context should be used when you are passing the context in the scope of an activity or you need the context whose lifecycle is attached to the current context.
3. What is Armv7?
There are 3 CPU architectures in Android. ARMv7 is the most common as it is optimised for battery consumption. ARM64 is an evolved version of that that supports 64-bit processing for more powerful computing. ARMx86, is the least used for these three, since it is not battery friendly. It is more powerful than the other two.
4. Why bytecode cannot be run in ?
Android uses DVM (Dalvik Virtual Machine ) rather using JVM(Java Virtual Machine).
5. What is a BuildType in Gradle? And what can you use it for?
Build types define properties that Gradle uses when building and packaging your app.
1. A build type defines how a module is built, for example whether ProGuard is run.
2. A product flavour defines what is built, such as which resources are included in the build.
3. Gradle creates a build variant for every possible combination of your project's product flavours and build types.
6. Explain the build process in .
1. First step involves compiling the resources folder (/res) using the aapt (android asset packaging tool) tool. These are compiled to a single class file called R.java. This is a class that just contains constants.
2. Second step involves the java source code being compiled to .class files by javac, and then the class files are converted to Dalvik bytecode by the "dx" tool, which is included in the sdk 'tools'. The output is classes.dex.
3. The final step involves the android apkbuilder which takes all the input and builds the apk (android packaging key) file.
7. What is the Application Architecture?
Android application architecture has the following components:
1. Services − It will perform background functionalities
2. Intent − It will perform the inter connection between activities and the data passing mechanism
3. Resource Externalization − strings and graphics
4. Notification − light, sound, icon, notification, dialog box and toast
5. Content Providers − It will share the data between applications
8. Describe activities
Activities are basically containers or windows to the user interface.
9. Lifecycle of an Activity
OnCreate(): This is when the view is first created. This is normally where we create views, get data from bundles etc.OnStart(): Called when the activity is becoming visible to the user. Followed by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.OnResume(): Called when the activity will start interacting with the user. At this point your activity is at the top of the activity stack, with user input going to it.OnPause(): Called as part of the activity lifecycle when an activity is going into the background, but has not (yet) been killed.OnStop(): Called when you are no longer visible to the user.OnDestroy(): Called when the activity is finishingOnRestart(): Called after your activity has been stopped, prior to it being started again
10. What's the difference between onCreate() and onStart()?
The method is called once during the Activity lifecycle, either when the application starts, or when the Activity has been destroyed and then recreated, for example during a configuration change.The onStart() method is called whenever the Activity becomes visible to the user, typically after onCreate() or onRestart().
You are reading the story above: TeenFic.Net