Android Developer

  Home  Mobile Technologies  Android Developer


“Android Developer related Frequently Asked Questions by expert members with professional career as Android Developer. These list of interview questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts”



56 Android Developer Questions And Answers

1⟩ Explain me 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.

 159 views

2⟩ Explain me what is the Android Application Architecture?

Android application architecture has the following components:

☛ Services − It will perform background functionalities

☛ Intent − It will perform the inter connection between activities and the data passing mechanism

☛ Resource Externalization − strings and graphics

☛ Notification − light, sound, icon, notification, dialog box and toast

☛ Content Providers − It will share the data between applications

 153 views

4⟩ Explain me how does the activity respond when the user rotates the screen?

When the screen is rotated, the current instance of activity is destroyed a new instance of the Activity is created in the new orientation. The onRestart() method is invoked first when a screen is rotated. The other lifecycle methods get invoked in the similar flow as they were when the activity was first created.

 140 views

5⟩ Explain me what is a broadcast receiver?

The broadcast receiver communicates with the operation system messages such as “check whether an internet connection is available,” what the battery label should be, etc.

 153 views

6⟩ What are content providers?

A ContentProvider provides data from one application to another, when requested. It manages access to a structured set of data. It provides mechanisms for defining data security. ContentProvider is the standard interface that connects data in one process with code running in another process.

When you want to access data in a ContentProvider, you must instead use the ContentResolver object in your application’s Context to communicate with the provider as a client. The provider object receives data requests from clients, performs the requested action, and returns the results.

 145 views

7⟩ Please explain what is difference between Serializable and Parcelable ? Which is best approach in Android?

Serializable is a standard Java interface. You simply mark a class Serializable by implementing the interface, and Java will automatically serialize it in certain situations.

Parcelable is an Android specific interface where you implement the serialization yourself. It was created to be far more efficient than Serializable, and to get around some problems with the default Java serialization scheme.

 196 views

10⟩ Tell us difference between Service, Intent Service, AsyncTask & Threads?

☛ Android service is a component that is used to perform operations on the background such as playing music. It doesn’t has any UI (user interface). The service runs in the background indefinitely even if application is destroyed.

☛ AsyncTask allows you to perform asynchronous work on your user interface. It performs the blocking operations in a worker thread and then publishes the results on the UI thread, without requiring you to handle threads and/or handlers yourself.

☛ IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.

☛ A thread is a single sequential flow of control within a program. Threads can be thought of as mini-processes running within a main process.

 158 views

14⟩ Explain me the difference between onCreate() and onStart()?

The onCreate() method is called once during the Activity lifecycle, either when the application starts, or when the Activity has been destroyed and then recreated, for example during a configuration change.

The onStart() method is called whenever the Activity becomes visible to the user, typically after onCreate() or onRestart().

 153 views

15⟩ What is access data using Content Provider

Start by making sure your Android application has the necessary read access permissions. Then, get access to the ContentResolver object by calling getContentResolver() on the Context object, and retrieving the data by constructing a query using ContentResolver.query().

The ContentResolver.query() method returns a Cursor, so you can retrieve data from each column using Cursor methods.

 140 views

16⟩ Tell us how would you update the UI of an activity from a background service?

We need to register a LocalBroadcastReceiver in the activity. And send a broadcast with the data using intents from the background service. As long as the activity is in the foreground, the UI will be updated from the background. Ensure to unregister the broadcast receiver in the onStop() method of the activity to avoid memory leaks. We can also register a Handler and pass data using Handlers.

 150 views

17⟩ Do you know what are Handlers?

Handlers are objects for managing threads. It receives messages and writes code on how to handle the message. They run outside of the activity’s lifecycle, so they need to be cleaned up properly or else you will have thread leaks.

Handlers allow communicating between the background thread and the main thread.

A Handler class is preferred when we need to perform a background task repeatedly after every x seconds/minutes.

 140 views

19⟩ Tell us what is DDMS? Describe some of its capabilities?

DDMS is the Dalvik Debug Monitor Server that ships with Android. It provides a wide array of debugging features including:

☛ port-forwarding services

☛ screen capture

☛ thread and heap information

☛ network traffic tracking

☛ incoming call and SMS spoofing

☛ simulating network state, speed, and latency

☛ location data spoofing

 154 views

20⟩ Explain 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.

 154 views