Skip to main content

Android Interview Questions(CH#1)

Android Interview Questions(CH#1)

Here is my sincere effort and contribution towards my community as I share some of the Top, Basic, Hot and Most Asked Questions in an Android Interview.
There is nothing like a short blog which helps you directly reach out to those tricky and unheard Interview Questions anytime, anywhere readily cooked for your hunger.

1) What is AAPT?
AAPT is an acronym for android asset packaging tool. It handles the packaging process.
2) What is NDK?
NDK stands for Native Development Kit. By using NDK, you can develop a part of app using native language such as C/C++ to boost the performance.
3) What is the Google Android SDK?
The Google Android SDK is a toolset which is used by developers to write apps on Android enabled devices. It contains a graphical interface that emulates an Android driven handheld environment and allow them to test and debug their codes.
4) What is an APK format?
APK is a short form stands for Android Packaging Key. It is a compressed key with classes,UI’s, supportive assets and manifest. All files are compressed to a single file is called APK.
5) Which types of flags are used to run an application on Android?
Following are two types of flags to run an application in Android:
FLAG_ACTIVITY_NEW_TASK
FLAG_ACTIVITY_CLEAR_TOP
6) What is singleton class in Android?
A singleton class is a class which can create only an object that can be shared all other classes.
7) What is DDMS?
DDMS stands for Dalvik Debug Monitor Server. It gives the wide array of debugging features:
Port forwarding services , Screen capture , Thread and heap information,
Network traffic tracking , Location data spoofing
8) What is NDK?
NDK stands for Native Development Kit. By using NDK, you can develop a part of app using native language such as C/C++ to boost the performance.
9) What is intent?
It is a kind of message or information that is passed to the components. It is used to launch an activity, display a web page, send sms, send email etc. There are two types of intents in android:
Implicit Intent
Explicit Intent
10) What are the core building blocks of android?
The core building blocks of android are:
Activity, View, Intent, Service, Content Provider, Fragment etc.
11) Can you describe the core building blocks of an Android application?
This top-level question is a great way to warm up the developer and get a feel for how well they understand the basics of building an Android app from scratch. The basic components are as follows:
Activity: An activity is a subclass of the “ContextThemeWrapper” class. Since almost all activities interact directly with the user, it is often helpful to think of an activity as the screen for a particular action, such as logging in or taking a picture.
View: The view is everything you can see on the screen of the app — think of the individual UI elements like buttons, labels, and text fields.
Intent: The main purpose of intent is to invoke individual components. Common uses include starting the service, launching activities, displaying a list of contacts, dialing a phone number, or displaying a web page.
Service: A service is a background process that can either be local or remote. Local services may be accessed from within the application while remote services are intended to be used by other applications running on the same device.
Content Provider: Content providers share data between applications.
Fragment: Fragments are best thought of as parts of an activity — you can display more than one fragment on the screen at the same time.
Android Manifest: The AndroidManifest.xml file provides essential information about your app required for it to run on the Android operating system. All Android apps have this file in their root directory.
12) Can you list and explain the four Java classes related to using sensors on the Android platform?
If your app requires the use of sensors like the accelerometer or gyroscope, you’ll want to make sure your developer is familiar with these four classes.
Sensor Manager: This class provides methods regarding the registration of sensor event listeners, the management of data acquisition, and calibration. It also provides methods for accessing and listing sensors.
Sensor: This class creates an instance of a specific sensor, providing methods that allow you to determine its capabilities.
SensorEvent: This class provides information on a sensor event by creating a sensor event object.
SensorEventListener: This interface provides two callback methods that can receive notifications of sensor events.
13) What are some measures you can take to avoid ANR?
The dreaded ANR (Application Not Responding) message appears to the user when an Android application remains unresponsive for a long period of time. ANR is typically caused when the app performs too much on the main thread. To avoid ANR, an app should perform lengthy database or networking operations in separate threads. For background task-intensive apps, you can alleviate pressure from the UI thread by using the IntentService. In general, it helps to always define time-outs for all your web service calls and to remain ever vigilant for infinite loops in complex calculations.
14) Why cannot you run standard Java bytecode on Android?
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.
15) 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
16) 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.
17) 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.
• A daemon, which runs as a background process on each emulator or device instance
18) Can you deploy executable JARs on Android? Which packaging is supported by Android?
No, Android platform does not support JAR deployments. Applications are packed into Android Package (.apk) using Android Asset Packaging Tool (AAPT) and then deployed onto Android platform. Google provides Android Development Tools for Eclipse that can be used to generate Android Package
19) Under what condition could the code sample below crash your application? How would you modify the code to avoid this potential problem? Explain your answer.
Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage); sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // “text/plain” MIME type startActivity(sendIntent);
An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can. If there is more than one application registered that can handle this request, the user will be prompted to select which one to use.
However, it is possible that there are no applications that can handle your intent. In this case, your application will crash when you invoke startActivity(). To avoid this, before calling startActivity() you should first verify that there is at least one application registered in the system that can handle the intent. To do this use resolveActivity() on your intent object:
// Verify that there are applications registered to handle this intent // (resolveActivity returns null if none are registered)
if (sendIntent.resolveActivity(getPackageManager()) != null) { startActivity(sendIntent);
}
20) What are the services that can be allowed to run in a single process?
  • Android allows all the services and applications to run on a single process. This behavior is the default behavior that can be changed by using the different settings and functions.
  • The process can be declared by using android: process attribute. This places the component explicitly on the process. Service is not a separate process and itself it’s a process if not defined separately.
  • The service is not used as a thread as well but it defines other threads in the program to do the work and create the application.
  • The application runs and finds the errors in the program and the service just takes the necessary actions on them. The service also responds to the errors whenever necessary.

If you like reading these questions and answers on Android, Do Share, Recommend and Forward this with your Fellow Android Developers, College Friends, Anyone eager to join Android Community and every other whom this article can come handy. Your help is always appreciated and honored.

Note : Stay Tuned for CH#2 for more Android Interview Questions.

Kudosss To The Android Developers for making Apps Greater.

Comments

Popular posts from this blog

My First Android App Story

Back in  November 2013 , pursuing Bachelor in Computer Applications from  GLSICA , me and some others students from the class are forced/asked to develop our projects compulsorily in  Android or iOS  just because we were in that  top-30  list of toppers. At that time, I don’t know even the  single piece of code  in Android. I have chosen to do project in Android because I don’t have an iOS device to test our app and the configurations in my laptop. After 2–3 days of  parliamentary discussion  we’ve reached to a conclusion that we will develop the App for  TGB Cafe n Bakery . Now when you don’t know any programming language, you go to Tutorial Sites but luckily from somewhere I got one of the best collection of  Android Tutorials  by  The New Boston  of about 200 videos. And slowly and gradually I get into this  incredible environment  of Android Programming with layouts and Java fi...

That Winning Moment!!!

That Winning Moment!!! You are just a thought away from the fact that the penultimate thing we all want in our career is that winning moment and the motivation to carry that winning momentum all through outside and inside our career span. Let’s take a sneak peek of what can be some of the greatest winning moments. * That Bird who assembles the Nest: Have you ever thought about that little bird who is continuously collecting those tiny little wooden sticks to assemble or make home for her young ones to keep there and feed there. How great that  moment  will be for that bird, when she place that final wood stick on her assembled nest to finish that small yet hardworking activity. The bird can die for that type of winning moment!!! * That college boy who got placed in an interview: Everyone of you have definitely been through that phase of your graduation or school-life where you got selected for sitting in ...

The Positives of Terrorism

The Positives of Terrorism From this ultimate post I wanna provide you with some positives of all the terrorists who are spreading violence all across the country, the continents and the world. The reason behind is even not exactly known to those terrorists, that are wandering around with weapons. Let’s start firing the positives: Positive#1 — Making Families Come Together Those hardworking terrorists kill anyone from any country, cast or religion and think that they are getting successful in destroying families altogether but those silly humans don’t know that they are actually making those families come more closer than ever by killing their loved ones. Yes I know this is sad-very-sad and heart-breaking especially for those affected families and their members, but if you take any positive from this situation than you can realise that those families are becoming emotionally more healthier than anybody else. Positive#2 - Making Citiz...