In this article, we'll look at some of the most commonly asked Android interview questions. The profession of Android application developer is in high demand. The following questions are very common in interviews for mid-level and entry-level Android developers. They are simple in nature, and are great for reviewing and practicing before going to an Android interview.
Question 2: What is ANR notification in Android?
ANR is short for
Application Not Responding . Systems running on the Android operating system show this dialog box if the application is performing a very resource-intensive task on the main thread and remains unresponsive for an extended period of time.
Question 1: What is the difference between a regular png image and a 9-patch?
This is one of the most popular Android interview questions. It is asked to developers with 1-2 to 5 years of experience. The answer is that it is a resizable bitmap resource that can be used for backgrounds or other images on the device. The NinePatch class provides the ability to render an image in nine areas. The extension of such images is .9.png . They can be expanded in nine ways: 4 corners are not scaled, 4 edges are scaled along one axis, and the middle area is scaled along both axes.Question 3: When is the onResume() method called?
MethodonResume()
is one of the activity life cycle methods. It is called when an activity comes to the foreground. You can override this method in your activity to execute code when the activity starts, restarts, or comes to the foreground. Here's a clear diagram explaining the execution sequence of various callback methods in Android, including
onResume()
:
Question 4: What is the difference between implicit and explicit intent?
Intent or Intent basically refers to messages that are transmitted between components (Activities, Services, Broadcast Receivers, Content Providers) . There are two types of intentions: implicit and explicit . Let's figure out what their differences are. 1) Implicit: Implicit intents are when calling default system intents such as sending an email, SMS, dialing a phone number, for example:Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
sendIntent.setType("text/plain")
startactivity(sendIntent);
2) Explicit: Explicit intent is used to move from one activity to another, for example, from activity
first
to activity
second
:
Intent intent = new Intent(first.this, second.class);
startactivity(intent);
You can learn more about explicit and implicit intent in the book
Introduction to Android Development By John Sonmez.
Question 5: What is APK format?
An APK file is a compressed fileAndroidManifest.XML
with the extension
.apk
. It contains application code (.dex files), resource files, and other files compressed into a single file.