Top 40 Android Interview Question And Answers: Here are the top interview questions of Android. Be prepared for the interview. You can download the entire questions in a pdf format. so guys All the best for your interview.
1) What is Android?
This operating system is Linux Kernel based. Using Android operating system, the developer develops the functions or programs which can perform basic as well as the advanced type of operations on the Smartphone.
Q2) What is Android SDK?
It has a Graphical User Interface which emulates the Android environment. This emulator acts as an actual mobile device on which the developers write their code and then debug/test the same code to check if anything is wrong.
3) What are the different versions of Android OS that you remember?
Answer: Given below are the various versions of Android.
|Android 7.0 – 7.1.2||Nougat|
|Android 6 – 6.0.1||Marshmallow|
|Android 5 – 5.1.1||Lollipop|
|Android 4.4 – 4.4.4||KitKat|
|Android 4.1 – 4.3||Jelly Bean|
|Android 4.0-4.0.4||Ice Cream Sandwich|
4) What is the difference between Mobile Application Testing and Mobile Testing?
Answer: Mobile app testing is the testing of applications on a device which mainly focuses on functions and features of the application.
And Mobile Testing is the testing of the actual mobile device and focuses on the mobile features like Call, SMS, Contacts, Media Player, inbuilt browsers etc.
You might also like: Top 50 Java Interview Question and Answers pdf Download
5) Name the languages supported for Android development.
Answer: Java is the widely used language for Android development.
It also supports C/C++ and when used with Android SDK, it improves the performance speed too.
6) What is the importance of having an emulator within the Android environment?
The emulator lets developers “play” around an interface that acts as if it were an actual mobile device. They can write and test codes, and even debug. Emulators are a safe place for testing codes especially if it is in the early design phase.
7) What is the use of an activityCreator?
An activityCreator is the first step towards the creation of a new Android project. It is made up of a shell script that will be used to create new file system structure necessary for writing codes within the Android IDE.
8 ) Describe Activities.
Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.
9) What are Intents?
Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.
10) Differentiate Activities from Services.
Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.
11) Explain briefly – what is meant by Activities?
Answer: Activities are the part of the mobile app which the user can see and interact with.
For Example, if you open an SMS app which has multiple activities like create new SMS, add a contact from the address book, write the content in the SMS body, send SMS to the selected contact, etc.
Activity keeps a track of the following:
- Keeps track of what a user is currently looking for in an app.
- Keeps a track of previously used processes, so that the user can switch between ongoing process and previous process.
- It helps to kill the processes so that the user can return to their previous state
An activity is implemented as a subclass of Activity class as shown below:
Public class MyActivity extends Activity
12) What is meant by Services?
Answer: Service is an Android component which runs in the background and acts independently. It does not provide any user interface.
Though the services are running behind the scene, a user can continue their work on different apps. Most of the time, the users are not aware of the services which are running in the background. These services allow the system to kill the process without interrupting the user’s ongoing work.
A service is implemented as a subclass of Service class:
Public class MainService extends Service
13) Explain Activity Lifecycle briefly.
Answer: When a user interacts with the app and moves here and there, out of the app, returns to the app, etc. During all this process “Activity” instances also move in the different stages in their lifecycle.
There are seven different states like – onCreate(), onStart(), onRestart(), onResume(), onPause(), onStop(), and onDestroy(). These are termed as a ‘callback’. Android system invokes these callbacks to know that the state has been changed.
14) What is an Intent?
Answer: Android has an Intent class when the user has to navigate from one Activity to another. Intent displays notifications from the device to the user and then the user can respond to the notification if required.
Given below are the two types:
- Implicit Intents
- Explicit Intents
15) Explain Implicit and Explicit Intents.
Answer: Implicit Intent calls the system components while explicit Intents invoke the Activity class.
16) What do you think are some disadvantages of Android?
Top 40 Android Interview Question And Answers: Given that Android is an open-source platform, and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy to how applications can adapt with various OS versions and upgrades. One app that runs on this particular version of Android OS may or may not run on another version. Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying features and specs.
17) What is adb?
Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.
18) What are the four essential states of an activity?
- Active – if the activity is at the foreground
- Paused – if the activity is at the background and still visible
- Stopped – if the activity is not visible and therefore is hidden or obscured by another activity
- Destroyed – when the activity process is killed or completed terminated
19) What is ANR?
ANR is short for Application Not Responding. This is actually a dialog that appears to the user whenever an application have been unresponsive for a long period of time.
20) Which elements can occur only once and must be present?
Among the different elements, the and elements must be present and can occur only once. The rest are optional, and can occur as many times as needed.
21) What is ADB?
Answer: Android Debug Bridge (ADB) is a command line tool which performs shell commands.
ADB is used for direct communication between the emulator ports. It gives the direct control of the communication between the emulator instances to the developer.
22) What is ActivityCreator?
Answer: ActivityCreator is a batch file and shell script which was used to create a new Android project. It is now replaced by “Create New Project” in Android SDK.
23) What is Orientation?
Answer: Orientation is the key feature in Smartphones nowadays. It has the ability to rotate the screen between Horizontal or Vertical mode.
Android supports two types of screen Orientations as mentioned below:
- Portrait: When your device is vertically aligned.
- Landscape: When your device is horizontally aligned.
setOrientation() is a method using which you can set a screen alignments. HORIZONTAL and VERTICAL are two values which can be set in the setOrientation() method. Whenever there is a change in the display orientation i.e. from Horizontal to Vertical or vice versa then onCreate() method of the Activity gets fired.
Basically, when the orientation of the Android mobile device gets changed then the current activity gets destroyed and then the same activity is recreated in the new display orientation. Android developers define the orientation in the AndroidManifest.xml file.
24) What is AIDL?
Answer: In the Android platform, there are remote methods which facilitate the use of methods from one program to another. To create and implement the remote methods the first step is to define communication interface in AIDL.
AIDL stands for Android Interface Definition Language. It facilitates the communication between the client and service. It also communicates the information through inter-process communication.
For communication between processes, the data is broken down into chunks which are easily understandable by the Android platform.
25) What are the data types supported by AIDL?
Answer: Data Types supported by AIDL are as follows:
- Java data types such as INT, Long, Char, Boolean etc
26) Is there a case wherein other qualifiers in multiple resources take precedence over locale?
Yes, there are actually instances wherein some qualifiers can take precedence over locale. There are two known exceptions, which are the MCC (mobile country code) and MNC (mobile network code) qualifiers.
27) What are the different states wherein a process is based?
There are 4 possible states:
- foreground activity
- visible activity
- background activity
- empty process
28) How can the ANR be prevented?
Top 40 Android Interview Question And Answers: One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.
29) What role does Dalvik play in Android development?
Dalvik serves as a virtual machine, and it is where every Android application runs. Through Dalvik, a device is able to execute multiple virtual machines efficiently through better memory management.
30) What is the AndroidManifest.xml?
This file is essential in every application. It is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.
31) How do you troubleshoot android application which is crashing frequently?
Answer: Given below are the few steps that we need to follow while troubleshooting the crashing issue:
- Free up memory space: There is only a limited space available on the mobile devices for mobile apps. To avoid crashing issue or memory related issue, you need to first check the memory space.
- Clear app data usage: You can clear the app data using the Application Manager under “Settings”. This will clear the cache memory and allow some free space to install another app or it will boost up your current app.
- Memory Management: Some apps run perfectly on one type of mobile device but the same app may not work on another type of device as for such devices the processing power, memory management, and CPU speed is different. For any app to run properly on any type of mobile device, you should manage the memory on the device.
- Compatibility issue: It is always not possible to test mobile app on all mobile devices, browsers, operating systems etc. So you need test your mobile app on as many mobile devices as you can in order to avoid any compatibility issue.
32) How do you find memory leaks in the mobile app on Android platform?
Answer: Android Studio is using Android Device Manager (ADM), this ADM is used to detect the memory leaks in the Android platform.
When you open ADM in the Android Studio then on the left-hand side of the ADM, you will find your device or emulator in which a heap sign will be displayed. When you are running any mobile app then you will see the heap size, memory analysis and other statistics displayed on it.
33) What is DDMS?
Answer: Android Studio has debugging tools known as DDMS i.e. Dalvik Debug Monitor Server.
It has wide debugging features which include:
- Port forwarding services.
- Screen capture on the device.
- Thread and Heap information.
- Incoming call and SMS spoofing.
- Radio state information.
- Location data spoofing.
DDMS is integrated with the Android studio. To launch the DDMS, you need to open Android Device Monitor (ADM) first and then click on the DDMS menu button. Once DDMS is launched, then on the left-hand side the list of connected devices are displayed along with the processes which are running on each device.
With the help of DDMS, you can debug both on real devices and emulators.
You might also like: Top 20 MongoDB Interview Questions and Answers
34) What are the different data storage options available on the Android platform?
Answer: Android platform provides a wide range of data storage options. These options must be used based on the need such as data is secure and used with the permission only or can be accessed publicly.
Below is the list of data storage options on the Android platform:
- SharedPreference: It stores data in XML files. It is the simplest way to store private data in the key-value pair.
- SQLite: It stores structure data in the private database.
- Internal Storage: It stores data in the device file system and any other app cannot read this data.
- External Storage: Data is stored in the file system but it is accessible to all apps in the device
35) Explain Sensors in Android.
Answer: Android-enabled devices have built-in Sensors which measures Orientation, Motion and other conditions.
These sensors provide data with high accuracy, which will help to monitor positioning and movement of the device. Some of the sensors are hardware based and few are software based.
There are three categories of sensors as mentioned below:
- Motion Sensors: These sensors measure the rotational & acceleration forces and it includes gravity sensors, rotational vector sensor, accelerometers, etc.
- Environmental Sensors: It measures air temperature, pressure, humidity, etc.
- Position Sensors: It measures the physical position of the device and includes orientation sensors and magnetometers.
There are four types of Java Classes as shown below:
- Sensor Manager
36) What is AIDL?
Top 40 Android Interview Question And Answers: AIDL, or Android Interface Definition Language, handles the interface requirements between a client and a service so both can communicate at the same level through interprocess communication or IPC. This process involves breaking down objects into primitives that Android can understand. This part is required simply because a process cannot access the memory of the other process.
37) What data types are supported by AIDL?
AIDL has support for the following data types:
-all native Java data types like int,long, char and Boolean
38) What is a Fragment?
Top 40 Android Interview Question And Answers: A fragment is a part or portion of an activity. It is modular in a sense that you can move around or combine with other fragments in a single activity. Fragments are also reusable.
39) What is a visible activity?
A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.
40) When is the best time to kill a foreground activity?
The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.
Top 40 Android Interview Question And Answers PDF Download