Home Android Most Common Interview Question and answers on Android

Most Common Interview Question and answers on Android

0

Most Common Interview Question and answers on Android

The Android Mobile Developer is responsible for developing high-quality native Android mobile code and driving a more modern, mobile-centric user experience. In this article, I tried to combine all the interview question and answers from the internet along with my own and friends interview experience.

Android Basics:-

Most Common Interview Question and answers on Android

(Q) What is Android?

Android is an operating system for mobile devices that includes middleware and key applications and uses a modified version of the Linux kernel.it was initially developed by Android Inc. it allows developers to write managed code in the Java language,
Controlling the device via Google-developed Java libraries.

(Q)What is ADT ( Android Developer Tool )?

ADT is a plugin for Eclipse that provides a suite of tools that are integrated with Eclipse IDE.

(Q)What is DDMS?

Dalvik Debug Monitor Service, a GUI debugging application shipped with the SDK. it provides screen capture, log sump, and process examination capabilities.

(Q) What is ADB?

Android Debug Bridge (ADB) is a versatile command line tool that allows to communicate with an emulator instance or connected Android-powered device.

(Q)What is the ADB command used to install an android application?

adb install “path_to_apk”

(Q)What is AIDL ?

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.

(Q) What are data types supported by ADIL?

AIDL has support for the following data types:-
. String
.charSequence
.List
.Map
. All native Java data types like int, long, char and Boolean

(Q) What are the steps in creating a bounded service through AIDL?

  1. Create the .aidl file, which defines the programming interface.
  2. Implement the interface, which involves extending the inner abstract stub class as well as implanting its method.3. expose the interface, which involves implementing the service to the client.

  3. expose the interface, which involves implementing the service to the client.

(Q) What is Dalvik Virtual Machine?

Dalvik is Android’s custom VM designed to ensure that multiple instances run efficiently on a single device.

Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality including security, threading and process and memory management.

(Q) What is AAPT?

AAPT is short for Android Assess Packaging tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.

(Q) What is the Android Architecture?

Android Architecture is made up of 4 key components.
. Linux kernel
.Libraries
.Libraries
.Android Framework
.Android Applications.

(Q) What is a context?

Context is an interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system.It allows access to application specific resources and classes, as well as up-cells for application-level operations such as launching activities, broadcasting and receiving intents, etc.

(Q) What is Lint?

Lint is a static code analysis tool that checks android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, accessibility, and internationalization.

(Q) What is pro guard and why is it important?

The ProGuard tool shrinks optimise and obfuscates code by removing unused code and renaming classes, fields, and methods with semantically obscure names.The result is a smaller sized .apk file that is more difficult to reverse engineer.

(Q) What is a .apk extension?

The extension for an Android package file, which typically contains all of the files related to a single Android application.The file itself is a compressed collection of an AndroidManifest.XML file, application code (.dex files), resource files, and other files.
A project is compiled into a single .apk file.

(Q) What is .dex extension ?

Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. ..dex files can be created by automatically translating compiled applications written in the Java programming.

(Q) What is an Application?

An Android app is a software application running on the Android platform. Because the Android platform is built for mobile devices, a typical Android app is designed for a smartphone or a tablet PC running on the Android OS.

(Q) Which programming language is used to write Android Applications?

java

(Q) Describe Android Application Architecture?

Services – like Network Operation
Intent – To perform inter-communication between activities or services
Resource Externalization – such as strings and graphicsNotification signaling users – light, sound, icon, notification, dialog etc.
Content Providers – They share data between applications

(Q) What are the advantages of Android?

  • The customer will be benefited from wide range of mobile applications to choose since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android.

  • Features like weather details, live RSS feeds, opening screen, icon on the

  • Innovative products like the location-aware services, the location of a nearby convenience store etc., are some of the additive facilities in Android.

(Q) Features of Android?

• Application framework enabling reuse and replacement of components
• Dalvik virtual machine optimized for mobile devices
• Integrated browser based on the open source WebKit engine optimized graphics powered by a custom 2D graphics library; 3D graphics
based on the OpenGL ES 1.0 specification (hardware acceleration optional)
• SQLite for structured data storage media support for common audio, video, and still image formats (MPEG4,
H.264, MP3, AAC, AMR, JPG, PNG, GIF)
• GSM Telephony (hardware dependent)
• Bluetooth, EDGE, 3G, and WiFi (hardware dependent)Camera, GPS, compass, and accelerometer (hardware dependent)
• Rich development environment including a device emulator, tools for
debugging, memory and performance profiling, and a plugin for the
Eclipse IDE

(Q) Why cannot you run standard Java bytecode on Android?

Android uses the Dalvik VM, instead of the Java VM. Due to this, you cannot execute standard Java programs on an Android device. Additionally, Android programs are supported by various XML files like the Android Manifest, layout files, resource files etc.The Android Manifest is especially important, as it contains information on which part of the app can be launched,which is a service or a receiver, what permissions the apps needs, what hardware and software features the app needs, which version of Android is compatible with it etc.

(Q) Can I write code for Android using C/C++?

yes. But you should use NDK.

(Q) Explain about the exception of Android?

InflateException : When an error conditions are occurred, this exception is thrown

Surface.OutOfResourceException : When a surface is not created or resized, this exception is thrown

SurfaceHolder.BadSurfaceTypeException : This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS

WindowManager.BadTokenException : This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.

(Q) Types of Android Applications?

  1. Foreground
  2. Background
  3. Intermittent
  4. Widget

(Q) What are the differences between this context and get application context? which one to use when?

This point to the current context, application context points to entire process. if your context is of an entire life time of process then use app context, else this.

Android ANR : What is the UI response time limit in android ( I.E with in how many seconds main thread has to respond to use actions) If user touches your activity, and if your program doesn’t respond to user events within 5 seconds,android will not tolerate it and it force closes your application. this error is called as ANR (application not responding)

(Q) What is solution for the ANR (application not responding) problem ?

Run only UI components in Main thread.

(Q) How to analyze android application crash, how to fix crash using log cat ?

After crash log cat will contain a file name, exception name along with line number where it has crashed.

(Q) What is the maximum memory limit given for each process or application in android?

16 MB is the maximum memory limit given to any given android application. some second generation phones will return 24 MB of memory for each process or even more.

(Q) What type of kernel is used in Android?

Linux modified kernel ( Monolithic) is used in Android.

(Q) 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.

Android Activity:-

Most Common Interview Question and answers on Android

(Q) What is Activity?

Activity is a Java code that supports a screen or UI. In other words, the building block of the user interface is the activity.Activity class is a predefined class in Android and every application which has UI must inherit it to create a window.

(Q) A life cycle of Activity?

An activity has essentially four states: if an activity in the foreground of the screen ( at the top pf the stack), it is active or running. If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused.

A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.

If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information.

(Q) How do you shut down an activity?

By calling finish() method.

(Q)Explain on create(Bundle) method and on pause() method? 

onCreate(Bundle) is where you initialize your activity. Most importantly, here you will usually call

setContentView(int) with a layout resource defining your UI, and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.

onPause() is where you deal with the user leaving your activity. Most importantly, any changes made by the user should at this point be committed (usually to the ContentProvider holding the data).

(Q) When is onResume() called?

onResume() is called just before the activity starts interacting with the user.

(Q) What is the visible lifetime of an activity?

The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop() . During this time the user can see the activity on-screen and interact with it.

(Q) When is the onStop() method invoked?

A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.

(Q) 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

(Q) When do you use startactivityForResult() ?

If we need to receive a result from the activity that we start. in that case, start the activity by calling startActivityForResult()

(Q) Activity launch mode?

  1. Standard
  2. SingleTop
  3. singleTask
  4. singleinstance

(Q) what is a resource?

A user-supplied XML,bitmap, or other file, injected into the application build process, which can later be loaded from code.

(Q) What is an action?

A description of something that an intent sender desires.

(Q) How will you launch an activity within your application?

The startActivity(Intent) method is used to start a new activity, which will be placed at the top of the activity stack. It takes a single argument, an Intent, which describes the activity to be executed.

(Q) What is the primary responsibility of Android’s Activity manager?

Android’s Activity Manager controls the life cycle of Activities and manages Activity stack level requirements.

(Q) How can you code an activity to receive intents those are sent by Broadcasting from other activity class?

programattically using registerReceiver method or by defining receiver tag in the manifest file of the application.

(Q) How do you handle configuration yourself?

To declare that your activity handles a configuration change, edit the appropriate <activity> element in your manifest file to include the android:configChanges attribute with a value that represents the configuration you want to handle.

(Q) By intent how we go from one Activity to another activity?

intent intent = new intent (this, DisplayMessageActivity.class);startActivity(intent);

(Q) What’s the difference between file, class, and activity in android?

File – It is a block of arbitrary information, or resource for storing information. It can be of any type

Class – Its a compiled form of .Java file . Android finally used this .class files to produce an executable apk

Activity – An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view

(Q) What are the different states wherein a process is based?

There are 4 possible states:
– foreground activity
– visible activity
– background activity
– empty process

Android Service:-

(Q) What is a Service?

A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application.

(Q) How to start a service?

A service is “started” when an application component (such as an activity) starts it by calling startService(). Once started, a service can run in the background indefinitely, even if the component that started it is destroyed.

(Q) What are the two essential forms a service can take ?

(Q) When is onStartCommand() getting called in a Service ?

(Q) When is onBind() getting called in a service ?

(Q) What is an IntentService ?

(Q) How can you ensure that your service is private to your application?

(Q) When to run a service in a separate process?

(Q) Differentiate Activities from Services?

(Q) What is AsyncTask?

(Q) What are the 4 steps in AyncTsk?

(Q) How to update UI from a service that has threads?

(Q) Service or thread: To do background functionality in activity, is it better to start service or thread? why ?

(Q) What is handler class do in android?

Android Broadcast Receiver:-

(Q) What happens when you trigger a system broadcast

(Q) What is Broadcast receivers?

(Q) What is a pending intent?

(Q) What is an intent Receiver ?

(Q) What is Sticky Intent?

(Q)Broacst Receiver Lifecycles?

(Q) Can an application be started on powerup?

Android Content Provider:-

(Q) What is SQLite ?

(Q) How we create table in SQLite?

(Q) How we open Database?

(Q) How we close a SQLite Database?

(Q) How we insert value to database?

(Q)How we read data from SQLite database?

(Q)How we update database?

(Q) How we delete Database?

(Q) What is the android helper class used to create and upgrade a database in android appilcation?

(Q) How many ways are there to store data in Android applciation?

(Q) What is Shared Preferences?

(Q) What method allows you to remove all values from the preferences?

(Q) What does SharedPreferences.Editor.-comit() method do ?

(Q) Can we share Data between Applications using shared predeferences?

(Q) What is Content Providers?

(Q) How will you record a phone call in Android?

(Q) How do you access data from assets folder in an android application?

Android Intent:-

(Q) What is an intent?

(Q) What is an intent filter?

(Q)What are the various information used for resolution of an intent?

(Q)What is an action from intents prespectives?

(Q) How many type of intent?

(Q) What is implicit intent?

(Q) What is Explicit Intent?

(Q) What is an URLs?

Android Fragments:-

(Q) What is a Fragment?

(Q) is it possible to use or add a fragment without using a user interface?

(Q) How to find a fragment in an activity?

(Q) How to return layout of a fragment ? Which function to implement in Fragment calls for it ?

(Q) What is the difference between activity and fragment in android?

(Q) What is the use of fragments?

Android Location:-

(Q) What is the main class through which an android application can access location service on Android

(Q)What is Geocoding?

(Q) What are the two main elements of location based services?

(Q)What are the user-permission tags to manifest for location based service?

(Q)Explain this method getlastKnownLocation()?

(Q)Describe request Locations Updates methods?

(Q)To main element of Location-based service?

(Q) How we get the instance of a specific location – provider ?

(Q) What is a webView?

(Q) What permission should be added to access the internet and load web pages in a web view?

(Q) Java Script is disabled in a webview default. true or False?

Android User Interface:-

(Q) Specify the directory name where the XML layout files are stored?

(Q) What is a View?

(Q) What is a View Group?

(Q) What is a Toast Notification?

(Q)What is a layout resource?

(Q)What is the importance of XML -based layouts?

(Q)What are the dialog boxes that are supported in android?

(Q) What is a Theme?

(Q)What tool allows you to create a Ninepatch graphic using a WYSIWYG editor?

(Q)What is the difference between a regular bitmap and a nine-patch image?

(Q)What is the use of 9 patch image compared to oher images?

(Q)What is List View?

(Q)What is Expandable List ViewWhat is Expandable List View?

(Q)What is orientation?

(Q)What are Containers?

(Q)What is Drawable?

(Q)How do you define the user interface?

(Q)What are the layouts in Android?

(Q)How do we solve Resolution problem?

(Q)What is Adapter?

(Q)How to crate a custom adapter in Android?

(Q)What is the class that i need to extend to create my own adapter?

Android manifest:-

(Q)What is the AndroidManifest.xml?

(Q)What is the root element of Androidmanifest.xml?

(Q)What happens when you specify in manifest?

(Q)What is permission?

(Q)What attribute to be declared in Android manifest to install the app in the external memory?

(Q)What exception will an application get if permissions are missing?

Android Other:-

(Q)What is Strict Mode?

(Q)What is Google Play?

(Q)What is Home screen widget?

(Q)When is onUpdate() called in an AppWidgetProvider ?

(Q)Does Android support the Bluetooth serial port profile?

(Q)What is Portable wifi Hotspot

Did you find the reason why I left the answer section?

Because More you discover more you learn. 🙂

Also Check:- TOP 3 Android Apps NOT available in Play Store

 

 

 

 

 

 

 

Advertisements

LEAVE A REPLY

Please enter your comment!
Please enter your name here

18 + fifteen =