Android Interview Questions – Excellence Technology

Android
Interview Questions

Android Interview Questions

Android is an open-source mobile operating system developed by Google. It is based on the Linux kernel and is designed primarily for touchscreen devices. Android is known for its customization, open ecosystem, and wide device compatibility, making it different from other mobile operating systems.

The Android application architecture consists of four main components:

  • Activities: Represent UI components and handle user interactions.
  • Services: Perform background tasks independently of the UI.
  • Broadcast Receivers: Respond to system-wide broadcast announcements.
  • Content Providers: Manage and share data between applications.

The Android Activity lifecycle consists of methods that are called at different stages of an activity's existence. Commonly used methods include:

  • onCreate(): Called when the activity is first created.
  • onStart(): Called when the activity becomes visible to the user.
  • onResume(): Called when the activity is ready for user interaction.
  • onPause(): Called when the activity is no longer in the foreground.
  • onStop(): Called when the activity is no longer visible.

Fragments represent a portion of an activity and allow for modular UI design. They have their own lifecycle and can be combined to create multi-pane UIs for tablets or adaptable UIs for different screen sizes. Fragments can be dynamically added or removed from an activity.

An Intent is a messaging object used to request an action or communicate between components (e.g., activities, services). It can be explicit (targeting a specific component) or implicit (allowing the system to determine the appropriate component). Intents are used to start activities, services, and broadcast messages.

Intent Filters are used to declare the types of intents a component can respond to. They are specified in the manifest file and include information such as action, data, and category. Intent Filters enable components to dynamically register to handle specific types of intents.

RecyclerView is a more flexible and efficient replacement for ListView in Android. It is used to display a scrolling list of elements and is designed to handle large data sets more efficiently. RecyclerView uses a ViewHolder pattern to improve performance by recycling views that are no longer visible.

CardView is a UI component that provides a flexible and consistent way to display information in a card-like format. It is often used in conjunction with RecyclerView to create a list of cards, each containing information or actions. CardView helps in achieving a modern and visually appealing design.

SharedPreferences is a key-value pair storage mechanism in Android. It allows the storage of simple data types, such as integers, booleans, strings, etc. SharedPreferences are often used for storing app preferences or small amounts of user-specific data.

  • SQLite: A traditional relational database included with Android. It uses SQL for querying and is suitable for structured data.
  • Realm: An object-oriented database that provides faster and more efficient data access. Realm supports automatic data syncing and is well-suited for mobile applications.

AsyncTask is a class in Android used for performing background tasks on a separate thread. It is commonly used for short-lived operations, such as network requests. AsyncTask provides methods like doInBackground, onPostExecute, and onProgressUpdate to handle background processing and UI updates.

Services are components in Android that run in the background and perform long-running operations independently of the UI. They can be used for tasks such as playing music, handling network requests, or monitoring sensors. Services can run in the foreground or background.

Android permissions are rules that determine the level of access an application has to device resources or data. They are declared in the AndroidManifest.xml file using the <uses-permission> element. Permissions are requested at runtime on devices running Android 6.0 (API level 23) and higher.

ProGuard is a code shrinker and obfuscator tool used in Android development to reduce the size of the APK and obfuscate the code, making it more difficult to reverse engineer. ProGuard removes unused code and renames classes, methods, and fields to make the APK smaller and more efficient.

The Android Testing Support Library provides classes and methods to support testing Android applications. It includes tools for unit testing, UI testing, and performance testing. Features like Espresso for UI testing and JUnit for unit testing are commonly used from this library.

  • Unit Testing: Involves testing individual units or functions of the code in isolation, typically without interacting with the UI. JUnit is a commonly used framework for unit testing.
  • UI Testing: Involves testing the user interface and interactions with the app. Espresso is a popular framework for UI testing in Android, allowing the simulation of user interactions.

Still have questions? Contact us We’d be Happy to help




    CAN'T FIND ANSWER? ASK US DIRECTLY!