Base 1 Flashcards
Android Interview Cheat I
What is Application?
The Application class in Android 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.
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 Android app has activities. Context is like a handle to the environment your application is currently running in.
What is 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.
What is 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.
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.
Why bytecode cannot be run in Android?
Android uses DVM (Dalvik Virtual Machine ) rather using JVM(Java Virtual Machine).
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 Android app.
A build type defines how a module is built, for example whether ProGuard is run. A product flavour defines what is built, such as which resources are included in the build. Gradle creates a build variant for every possible combination of your project’s product flavours and build types
Explain the build process in Android:
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.
What is the Android Application Architecture?
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
Describe activities
Activities are basically containers or windows to the user interface.