Android Interview Questions and Answers For Freshers
Android uses Dalvik Virtual Machine (DVM) which requires a special bytecode. First of all, we have to convert Java class files into Dalvik Executable files using an Android tool called “dx”. In normal circumstances, developers will not be using this tool directly and build tools will care for the generation of DVM compatible files.
2. Can Android application only be programmed in Java?
No, it is not necessary. You can program Android apps can be created using NDK in C/C++. The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++. Typically, good use cases for the NDK are CPU-intensive applications such as game engines, signal processing, and physics simulation.
3. Where will you declare your activity so the system can access it?
Activity is to be declared in the manifest file. For example:
3. <activity android:name=”.MyIntellipaat”></activity>
4. What is the difference between a regular .png and a nine-patch image?
It is a resizable bitmap resource that can be used for backgrounds or other images on the device. NinePatch class permits drawing a bitmap in nine sections. The nine patch images have extension as.9.png. It allows extension in 9 ways, i.e. 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.
5. What is the difference between an implicit intent and explicit intent?
There are two types of Intent implicit and explicit intent, let see some more difference between them.
1) Implicit: Implicit intent is when you call system default intent like send email, send SMS, dial number
Intent sendIntent = new Intent();
2) Explicit: Explicit intent when you call you’re on application activity from one activity to another
For example, first activity to second activity
Intent intent = new Intent(first.this, second.class);
6. Where can you define the icon for your Activity?
Icon for an Activity is defined in the manifest file.
<activity android:icon=”@drawable/app_icon” android:name=”.MyTestActivity”></activity>
which means you have to Open AndroidManifest.xml.Right under the root “manifest” node of the XML, we can see the “application” node. We have add this attribute to “application”. (The “icon” in “@drawable/icon” refers to the file name of the icon.)
7. What is ADB?
ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator instance. ADB can control your device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands, and more. It is a client-server program that includes three components:
• A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as DDMS also create adb clients.
• A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
8. What are the different storage methods in Android?
Android offers several different options for data persistence. Shared Preferences – Store private primitive data in key-value pairs. This sometimes gets limited as it offers only key value pairs. You cannot save your own java types. Internal Storage – Store private data on the device memory.
9. What is action in Android?
Action, in Android, is a description of something that an Intent sender desires.
<action android:name=”string” />
Adds an action to an intent filter. An element must contain one or more elements. If it doesn’t contain any, no Intent objects will get through the filter.
10. What is an ANR notification in Android?
ANR is short for Application Not Responding. Android systems show this dialog if the application is performing too much of task on the main thread and has been unresponsive from a long time.