June 27, 2022

Android Interview Questions 1

What’s Android?

Android is a Linux-based, open-sourced operating system commonly found on mobile devices, such as smartphones and tablets. It’s a kernel-based system that gives developers the flexibility to design and deploy simple and/or advanced apps.


Explain the Android SDK?

This is a set of tools that Android developers use in order to develop or write apps. It features a graphical user interface that emulates a handheld, Android-driven environment, making it easier for developers to create, test, and debug their code.

The tools include:

  • Dalvik Debug Monitoring Services
  • Android Emulator
  • Android Asset Packaging Tool
  • Android Debug Bridge


What is use of AndroidManifest.xml file?

AndroidManifest.xml file is responsible to protect the application from accessing any protected parts by providing the permissions. Every app project has an AndroidManifest.xml file which is also the root of the project source set. This file contains information about your package, Android operating system, the Android build tools, Google Play, and other including components of the application such as activities, content providers, services, broadcast receivers, etc.


What is an android application architecture?

The Android architecture consists of:

  • Android Framework
  • Android Applications
  • Linux Kernel
  • Libraries


Name the basic tools for developing an Android App?

The tools used for development are:

  • JDK
  • SDK Tools
  • Eclipse+ADT Plugin

What does APK mean?

It’s short for Android Packaging Kit. Every file in the Android packaging key is compressed into a single file, the APK.


What are Activities?

These are the parts of a mobile app that a user sees and interacts with. It represents a Graphic User Interface (GUI), representing one Android screen.


State the life cycle methods of Android activities?

There are seven lifecycle methods of Android activities. They are:

  • On create()
  • On start()
  • On resume()
  • On pause()
  • On stop()
  • On restart()
  • On destroy()


What are the four essential activity states?

The four states are:

  • Active: The activity is at the top of  the stack, running in the foreground
  • Paused: The activity is still visible but cannot receive user input events; it’s in the background
  • Stopped: The activity is invisible and consequently is paused, and obscured or hidden by a different activity
  • Destroyed: The activity’s process has been killed, completed, or terminated


What is a fragment in Android?

The fragment in Android is as follows.

A fragment has its own layout and behavior with its own life cycle callbacks.

Fragments can be added or removed in an activity while the activity is running and used in multiple activities.

Multiple fragments can be combined in a single activity to build a multi-pane UI.

The fragment life cycle is closely related to the life cycle of its host activity which means when the activity is paused, all the fragments available in the activity will also be stopped

Fragments were added to the Android API in the Honeycomb version of Android API version 11.


What’s a content provider?

Content providers share information between different Android applications. They allow users to access data within an application. Examples include contact information, images, video, and audio.


What’s an intent in the context of Android? Describe the different types?

Much what it sounds like, it’s the intention to perform an action, a message that is passed between components. Intents request actions from a different component, such as sending an email, opening a web page, or launch a given activity. The two types are:

  • Implicit Intent This is where the intent doesn’t define the target component, requiring the Android system to conduct an evaluation of the components.
  • Explicit Intent On the other hand, the explicit intent directly identifies the target component.


What’s a sticky intent?

This is a broadcast using the send sticky broadcast() method. The intent sticks around after the broadcast, which allows others to collect data from it.


What is a Pending Intent?

A Pending Intent is an action to require in the future. It allows you to pass a future Intent to a different application and permit that application to execute the Intent.


What’s a “bundle” in Android?

Bundles are used to pass the required data to sub-folders


What is ANR?

This is an acronym for Application Not Responding, a pop-up or notification that kicks in when the application is experiencing lag time for the user due to too many functions being performed simultaneously.


What's the difference between onCreate() and onStart()?

The major difference between onCreate() and onStart() is as follows.

onCreate() is called when the Activity is created; that is, it is launched or started. (Additionally, this triggers when the orientation is changed.) It is called again when the process is killed, then returned to.

while onStart() called following onCreate() at startup. Additionally, it is also called when the app is navigated back to after onStop() (and following onRestart()), which occurs after the Activity is no longer visible (which is during the time that "the user can see the activity on-screen, though it may not be in the foreground and interacting with the user").


 What is service in Android? List its types?

Services in Android are a component that acts as an application to run in the background in order to perform long-running operation tasks.

The types of Services are listed below:

  • Background Services
  • Foreground Services
  • Bound Services

Explian the use of AsyncTasks?

Android AsyncTask going to do background operation on the background thread and update on the main thread. In android, We can't directly touch the background thread to the main thread in android development. asyncTask helps us to make communication between the background thread to the main thread.


Explain different launch modes in Android?

Different launch modes are explained below:

Android Launch mode 'Standard' — Multiple instances every time, A very default launch mode!

Launch mode 'SingleTop' — Multiple instances Conditionally

Specialized Launch mode 'SingleTask' — Single instance throughout System.

Specialized Launch mode 'SingleInstance' — Single instance throughout System.


What is Proguard?

Proguard detects and removes unused classes, fields, methods, and attributes. Mobile app development companies use the Proguard in android, it optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods by using short meaningless names.


What is the difference between Serializable and Parseable?

Serializable is a standard Java interface. It is not a part of the Android SDK. Its simplicity is its biggest beauty. Just by implementing this interface the POJO will be ready to jump from one particular activity to another. There is another interface known as parseable. It is a part of the Android SDK. Paracelable was specifically designed in a way that there is no reflection left while using.


Give a brief idea about Android application architecture?

The architecture of Android application has few components, which have their functions to perform:

Service: It performs the background functions

Intent: Performs the interconnection function between activities and data passing mechanism

Resource: Externalization it is used to perform strings and graphics functions

Notification: This shows the lights, sound, icon, notification, incoming chats messages dialogue box, etc.

Content providers: It shares the data between applications.


What are few exceptions in Android?

These are the following exceptions in Android:

  • Inflate exception
  • Surface.out of resource exception
  • Surface holder bad surface type exception
  • Window manager took exception.


Explain Orientation?

Orientation is set using set orientation (), dictates whether the linear layout is represented as a row or else as a column. There the values are set as HORIZONTAL or VERTICAL.


what is the differentiate between Activities and Services?

Activities can be closed or can be terminated easily as and when the user wants to. Services are designed to run on the background or behind the scenes and can act independently. Most of the services run on a continuous basis regardless of their certain or no certain activities been executed.


What are runnable in android?

Runnable is a concurrent unit of execution in Android. It is also a class that implements a Runnable interface. The Runnable interface is used extensively to execute code in Threads.



No comments:

Post a Comment