List Headline Image
Updated by edureka.co on Oct 18, 2021
 REPORT
edureka.co edureka.co
Owner
10 items   1 followers   0 votes   81 views

Top Android Interview Questions To Prepare In 2019

The demand for Android developers is on a meteoric rise and the time is right to break into a career in Android development. To help you get started, here is a list of frequently asked Android interview questions to help you ace the Android interviews that come your way.

1

What is the latest version of Android? List all the versions of Android.

What is the latest version of Android? List all the versions of Android.

The latest version is Android 9.0- Android Pie released in August, 2018. Android is a mobile operating system developed by Google. It is based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets. Every other Android version has been named after either sweet or desserts. The above table represents the Android name, version and the year of release.

2

What is an Activity? Which method is implemented by all subclasses of an Activity?

An Activity is the screen representation of an application in Android.

It serves as an entry point for the user’s interaction. Each activity has a layout file where you can place your UI. An application can have different activities. For example, facebook start page where you enter your email/phone and password to login acts as an activity.

Below are the two methods which almost all subclasses of Activity will implement:

onCreate(Bundle): It is a method where your initialization is done. Under this, you will callsetContentView(int) with a layout resource which defines your UI. Also, you can retrieve the widgets in that UI by using findViewById(Int). These are required to interact programmatically.
onPause(): It is a method which deals with the user whenever it leaves the activity. So any changes made by the user should be commited which is done by the ContentProvider that holds the data.
An activity is implemented as a subclass of Activity class as follows:

public class MainActivity extends Activity {
}

3

What are the features of Android?

Google has changed the lives of everyone by launching a product that improves the mobile experience for everyone. Android helps in understanding your tastes and needs, by giving various features such as having wallpapers, themes, and launchers which completely change the look of your device’s interface.

Android has plenty of features. Some of the features are listed below:

Android - Android Interview Questions - EdurekaOpen-source
Customizable operating System
Variety of apps can be developed.
Reduces overall complexity
Supports messaging services, web browser, storage(SQLite), connectivity,media and many more.

4

What is the life cycle of android activity?

User navigates between different screen or app, it goes through different states in their lifecycle. So an activity lifecycle consists of 7 different methods of android.app.Activity class i.e :

onCreate() : In this state, the activity is created.

onStart(): This callback method is called when the activity becomes visible to the user.

onResume(): The activity is in the foreground and the user can interact with it.

onPause(): Activity is partially obscured by another activity. Other activity that’s in the foreground is semi-transparent.

onStop(): The activity is completely hidden and not visible to the user.

onDestroy(): Activity is destroyed and removed from the memory.

5

Define intents in Android. What are the different types of intents?

An Intent is an “intention” to do an action. An intent is a messaging object you can use to request an action from another app component.

Methods are used to deliver intents to different components:

context.startActivity() – To start an activity
context.startService() – To start a service
context.sendBroadcast() – To deliver a broadcast

Types of Intent:
Implicit Intent: Implicit intent is when the target component is not defined in the intent and the android system has to evaluate the registered components based on the intent data.

Explicit Intent: Explicit intent is when an application defines the target component directly in the intent.

6

What is the difference between File, Class, and Activity in android?

The difference between them are as follows:

*File *is a block of arbitrary information or resources for storing information. It can be any file type.
*Class *is a compiled from of .Java file which Android uses to produce an executable apk.
*Activity *is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type but just a class that can be extended in Android to load UI elements on view.

7

What is a Toast? Write its syntax.

  • Toast notification is a message that pops up on the window.
  • It only covers the expanse of space required for the message and the user’s recent activity remains visible and interactive.
  • The notification automatically fades in and out and does not accept interaction events.

Syntax:

Toast.makeText(ProjectActivity.this, "Your message here", Toast.LENGTH_LONG).show();

8

What is an ANR? What are some measures you can take to avoid ANR?

ANR stands for ‘Application Not Responding’. This dialogue is displayed if the main thread in the application has been unresponsive for a long time and in the following conditions:

  • When there is no response to an input event after 5 seconds.
  • When a broadcast receiver is not done executing within 10 seconds.

    Following measures can be taken to avoid ANR:

  • To avoid ANR, an app should perform a lengthy database or networking operations in separate threads.

  • One technique is to create a child thread to prevent the Android system from concluding a code that has been unresponsive for a long period of time. Most of the actual workings of the codes can be placed within the child thread to ensure that the main thread runs with minimal unresponsive time.
  • For background task-intensive apps, you can alleviate pressure from the UI thread by using the IntentService.
9

What is the use of WebView in Android?

WebView is a view that display web pages inside your application. According to Android, “this class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more. In order to add WebView to your application, you have to add element to your XML layout file.

10

How does Manifest file plays an integral role in App development?

Manifest file plays an integral role as it provides the essential information about your app to the Android system, which the system must have before it can run any of the app’s code. Manifest file performs various tasks such as:

  • It names the Java package for the app as the package name serves as a unique identifier for the application.
  • It protects the application by declaring permissions in order to access protected parts of the API and interact with other applications.
  • Manifest file declares the minimum level of the android API and list the libraries which is linked with the application.
  • Manifest file list the instrumentation classes. These classes provide profiling and other information as the application runs, but this information is removed as soon the application is publishes. It remains only till the application is in development mode.

Structure of a manifest file: The structure of a manifest file consists of various elements such as action, activity, activity-alias and many more. Refer to the below screenshot which shows the general structure of the manifest file.

version="1.0" encoding="utf-8"?
cmanifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aayushi.myapplication">

To keep reading more questions like these you can click here