Questions Flashcards

1
Q

How Do You Manage Resources for Different Screen Sizes?

A

Android devices come in a variety of sizes and resolutions. When you’re building your app, it’s important to decide which of the many models you will support. Once you’ve made this decision, there are three common approaches you can take to make sure your app supports all screen sizes:

Use view dimensions.
Create several layouts, depending on the screen.
Provide your images and resources as bitmaps.
Of course, you may also use a combination of these approaches in your app.

The Android developers website covers this in detail in the article Support different screen sizes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What Is Android Jetpack?

A

Jetpack is a suite of libraries released by Android in 2018. Jetpack’s libraries provide code that works across the many Android devices currently in use. This makes it easy for developers to adhere to best practices!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

33) What is the importance of Default Resources?

A

When default resources, which contain default strings and files, are not present, an error will occur and the app will not run. Resources are placed in specially named subdirectories under the project res/ directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

21) How are escape characters used as attribute?

A

Escape characters are preceded by double backslashes. For example, a newline character is created using ‘\n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What Are Activities and Fragments?

A

An activity is a single thing the user can do within your app. The activity class takes care of creating a window in which you place your UI. A fragment is a small piece of functionality within this activity.

Since 2018, Android recommends creating single-activity apps. An app should consist of fragments within a host activity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What Is an Intent?

A

Intents are messaging objects that trigger actions from other components. These target components can include services and activities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

8) What are the four essential states of an activity?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

48) What is an action?

A

In Android development, an action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Other Libraries?

A

In the Android world, you’ll encounter many libraries in addition to those in Jetpack. Your interviewer may ask about these. Here are some of the most common:

Libraries for network requests: Retrofit, GraphQL
Libraries for images: Picasso
Dependency Injection: Dagger
Reactive Programming: RXJava and RXKotlin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe two kinds of intent?

A

An explicit intent specifies a particular destination for fulfillment. You can direct your intent to an external app. But an explicit intent commonly targets another component within your app. When using an explicit intent, your code must provide the name of the target app or component.

Implicit Intent

An implicit intent does not specify the target component. Instead, it states an action to perform. The Android system directs the intent to an external app capable of fulfilling it. For example, if your app needs to send an email, the Android system will select options from the email apps installed on the device. The user can select the desired email app.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What Are Unit Tests? How Do You Do Them in Android?

.

A

Unit tests run locally. Since they aren’t run on a device, they don’t have access to any Android framework library. It’s possible to use libraries that allow you to call Android framework methods from unit tests, however these libraries substitute only simulate device behavior. The preferred libraries are either JUnit or Mockito.

The ability to design and implement unit testing is usually a requirement for mid-senior to senior levels. If you want to learn how to do this, here are some resources:

JUnit is the standard java library for testing, which is usually coupled with AndroidX Test. This is covered in our tutorial Test-Driven Development Tutorial for Android: Getting Started.
Mockito is another popular open-source testing framework. You can learn more about it in our tutorial Android Unit Testing with Mockito
Instrumentation Tests

Instrumentation tests are quite similar to unit tests but depend on a device or simulator to run. Since instrumentation tests are run on device, you have access to the Android device libraries. The two libraries mentioned above, JUnit and Mockito, are also used for instrumentation tests.

UI Tests

UI tests simulate a user’s interactions with your UI. The most popular library for testing is Espresso. You can learn about UI testing in our tutorial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

) Do all mobile phones support the latest Android operating system?

A

Some Android-powered phone allows you to upgrade to the higher Android operating system version. However, not all upgrades would allow you to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

45) What is a Sticky Intent?

A

A Sticky Intent is a broadcast from sendStickyBroadcast() method such that the intent floats around even after the broadcast, allowing others to collect data from it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

41) Is it possible to use or add a fragment without using a user interface?

A

Yes, it is possible to do that, such as when you want to create a background behavior for a particular activity. You can do this by using add(Fragment,string) method to add a fragment from the activity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

11) What items are important in every Android project?

A

These are the essential items that are present each time an Android project is created:

AndroidManifest.xml
build.xml
bin/
src/
res/
assets/
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

39) What is a visible activity?

A

A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

30) What is the AndroidManifest.xml?

A

This file is essential in every application. It is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What Are Layouts in Android?

A

Layouts define the structure of the UI of an app. They consist of View and ViewGroup objects, arranged hierarchically. There are different types of layout:

Constraint Layout
Linear Layout
Relative Layout
Because this is one of the most complex concepts in Android, we cover layouts in both a video course, Beginning Android Layouts, and a tutorial, ConstraintLayout Tutorial for Android: Getting Started. Please review them if you need a better understanding of this important subject!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

22) What is the importance of settings permissions in app development?

A

Permissions allow certain restrictions to be imposed primarily to protect data and code. Without these, codes could be compromised, resulting to defects in functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

31) What is the proper way of setting up an Android-powered device for app development?

A

The following are steps to be followed prior to actual application development in an Android-powered device:

  • Declare your application as “debuggable” in your Android Manifest.
  • Turn on “USB Debugging” on your device.
  • Set up your system to detect your device.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

38) What is a Fragment?

e.

A

A fragment is a part or portion of an activity. It is modular in a sense that you can move around or combine with other fragments in a single activity. Fragments are also reusabl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

42) How do you remove icons and widgets from the main screen of the Android device?

A

To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower part of the screen where a remove button appears.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What Is View Binding?

A

View binding replaces findViewById. It uses binding classes to do this. These classes contain references to all views that have an ID in the corresponding layout.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

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

A

There are 4 possible states:

foreground activity
visible activity
background activity
empty process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

35) When does ANR occur?

A

The ANR dialog is displayed to the user based on two possible conditions. One is when there is no response to an input event within 5 seconds, and the other is when a broadcast receiver is not done executing within 10 seconds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

29) What role does Dalvik play in Android development?

A

Dalvik serves as a virtual machine, and it is where every Android application runs. Through Dalvik, a device is able to execute multiple virtual machines efficiently through better memory management.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

. What is Android?

A

Android is an open-sourced operating system that is used on mobile devices, such as mobiles and tablets.
The Android application executes within its own process and its own instance of Dalvik Virtual Machine(DVM) or Android RunTime(ART).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q
  1. What are the features of Android architecture?
A

Android architecture refers to the various layers in the Android stack. It consists of operating systems, middleware, and applications. Each layer in the Android architecture gives different services to the layer just above it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is an activity?

A

Activity in java is a single screen that represents GUI(Graphical User Interface) with which users can interact in order to do something like dial the phone, view email, etc.

For example, the Facebook start page where you enter your email/phone number and password to log in acts as an activity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

The five layers present in the Android stack are:

A

1-Linux Kernel - It is responsible for device drivers, device management, memory management, power management, and resource access.

2-Libraries - There are a set of libraries having open-source Web browser engine WebKit, well-known library libc, libraries to play and record audio and video, SQLite database for sharing of application data and storage, SSL libraries for internet security, etc.

3-Android Runtime - There are core libraries along with DVM (Dalvik Virtual Machine) or ART(Android RunTime) as runtime which is helpful for running an Android application. DVM is optimized for mobile devices. DVM provides fast performance and consumes less memory. Replacing DVM, ART(Android RunTime) virtual machine was introduced to execute android apps from Android lollipop 5.0 version (API level 21).
4-Android Framework - It consists of Android APIs like UI (User Interface), resources, content providers (data), locations, telephony, and package managers. It provides interfaces and classes for the development of Android applications.

5-Android Applications - Applications like home, games, contacts, settings,
browsers, etc. uses the Android framework that will make use of Android runtime and libraries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

How can the ANR be prevented?

A

One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

47) What is portable wi-fi hotspot?

A

Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access point

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

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

A

In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

34
Q

34) When dealing with multiple resources, which one takes precedence?

A

Assuming that all of these multiple resources are able to match the configuration of a device, the ‘locale’ qualifier almost always takes the highest precedence over the others.

35
Q

43) What are the core components under the Android application architecture?

A

There are 5 key components under the Android application architecture:

– services
– intent
– resource externalization
– notifications
– content providers
36
Q
  1. What is AAPT?
A

AAPT is short for Android Asset 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.

37
Q

23) What is the function of an intent filter?

A

Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.

38
Q

What are Android Architecture Components?

A

Architecture Components are a collection of libraries included in Jetpack. They help you implement clean architecture in your app, based primarily on the MVVM (Model-View-ViewModel) pattern.

39
Q

7) What is the use of an activityCreator?

A

An activityCreator is the first step towards the creation of a new Android project. It is made up of a shell script that will be used to create new file system structure necessary for writing codes within the Android IDE.

40
Q
  1. What is an Adapter in Android?
A

An adapter in Android acts as a bridge between an AdapterView and the underlying data for that view. The adapter holds the data and sends the data to the adapter view, the view can take the data from the adapter view and shows the data on different views like a spinner, list view, grid view, etc.

41
Q

What is the importance of having an emulator within the Android environment?

A

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.

42
Q

37) What data types are supported by AIDL?

A

AIDL has support for the following data types:

  • string
  • charSequence
  • List
  • Map
  • all native Java data types like int,long, char and Boolean
43
Q

What Is the Gradle Build System?

A

Android Studio uses Gradle for building apps. An Android plugin for Gradle compiles, builds and packages apps or libraries. Gradle files also include dependencies and their versions.

Gradle files, historically, use Groovy as their required language. However, since 2019, you can also use the Kotlin language to code Gradle files in Kotlin apps.

We have two great articles on Gradle. Take a look at both Gradle Tutorial for Android: Getting Started and Gradle Tips and Tricks for Android for a deeper dive.

44
Q
  1. What is a service in Android?
A

Service is an application component that facilitates an application to run in the background in order to perform long-running operations without user interaction. A service can run continuously in the background even if the application is closed or even after the user switches to another application.

45
Q

20) Which elements can occur only once and must be present?

A

Among the different elements, the “and” elements must be present and can occur only once. The rest are optional, which can occur as many times as needed.

46
Q

12) What is the importance of XML-based layouts?

A

The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

47
Q

What Is a RecyclerView?

A

Most apps out there contain at least one RecyclerView, so it’s a key topic you should know. A RecyclerView is a widget provided in the Android SDK. It’s used to display a list of elements. RecyclerView is designed to display lists that don’t fit on one screen and require scrolling.

48
Q

Describe Activities.

A

Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.

49
Q

What Kind of Layouts Can You Have for RecyclerViews?

When you create a RecyclerView, you have the flexibility to define one of the following layout types.

A

Linear Layout
Grid Layout
There’s a lot the developer needs to know about RecyclerView. If you need a refresher on this topic, take a look at our course Beginning RecyclerView.

The Android developers website also has a comprehensive article, Create a List with RecyclerView.

50
Q

14) What is Orientation?

A

Orientation, which can be set using setOrientation(), dictates if the LinearLayout is represented as a row or as a column. Values are set as either HORIZONTAL or VERTICAL.

51
Q

44) What composes a typical Android application project?

A

A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.

52
Q

What Is Localization? How Do You Do It in Android?

A

Localization is the ability of an app to support multiple languages, time zones, currencies, number formats, etc. This allows you to distribute your app widely to different countries and populations. Your app can bundle its localization through using Android’s resource directory framework, which specifies items (strings, images, layouts…) for different locales.

53
Q

10) Differentiate Activities from Services.

A

Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed

54
Q

List the languages used to build Android.

A

Java: It has always been a starting point for new developers and used by the majority of people who work with Android development. Eclipse, NetBeans, and IntelliJ IDE are the most popular IDE’s(Integrated Development Environment) used for developing an Android application using java.
Kotlin: Kotlin is a relatively new, modern, safe, and object-oriented cross-platform programming language used in developing an Android application. IDE’s used with kotlin are Android studio, Eclipse IDE, etc.
C#: Developers can build native iOS and Android mobile applications by using the C# language. Visual Studio is the best tool for developing an Android application using C#.
Python: It is a dynamic and object-oriented programming language. It is very popular in machine learning. Pydroid 3, Dcoder, spck code editor is some of the code editors for Python.
Other languages which can be used in Android development are C++, HTML 5. C4droid, CppDroid, AIDE, etc. are IDE’s for C++. Acode, spck code editor, etc. are examples of IDE’s used with HTML

55
Q

What Is the App Lifecycle?
For any Android interview, you should be able to explain the lifecycle of an app. When interviewers ask this question, they’re usually looking for familiarity with the activity’s six callbacks:

A
onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()
You should be able to name each activity and describe what it does and why it’s important. If you’re not sure about these, you can review the article Understand the Activity Lifecycle, in the Android developers website.
56
Q

What are Configuration Changes and When Do They Happen?

A

Configuration changes cause Android to restart the activity. They include changes to screen orientation, keyboard availability and multi-window mode. When a configuration change occurs, you must issue a call to onDestroy(). You follow this with a call to onCreate().

This is a key design topic! You’ll want to mention ways to support configuration changes and persist data so you can rebuild your activity. One approach might be to use ViewModels, which you’ll cover later.

57
Q

What Are Support Libraries?

A

Android Support Libraries are packages that contain code. They support a specific range of Android platform versions and sets of features. Most of these support libraries are now part of the androidx namespace. This is the recommended set of libraries to use.

58
Q
  1. What is the use of Bundle in Android?
A

Bundles are used to pass the required data between various Android activities. These are like HashMap that can take trivial data types. Below code shows how to transfer a piece of data by using bundle:

59
Q

6) What do you think are some disadvantages of Android?

A

Given that Android is an open-source platform, and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy to how applications can adapt with various OS versions and upgrades. One app that runs on this particular version of Android OS may or may not run on another version. Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying features and specs.

60
Q

What Is LiveData?

A

LiveData is an observable class. The advantage of LiveData over libraries like Rx is that it is lifecycle-aware. It only updates data in the STARTED or RESUMED state.

61
Q

What Is Material Design?

A

Material design is a design language that Google developed in 2014. It consists of the building blocks for your UI components. This language, and the design principles it embodies, are applicable to Android as well as other applications.

Google provides a detailed guide to material design in its Design guidance and code. You can review this guide while developing your apps.

62
Q

What Are Quality Guidelines?

A

Google also provides an extensive list of quality guidelines. You can use this list to ensure that your app adheres to current quality standards. If your app passes these tests, you can be sure it meets your users’ expectations for performance, stability, and security.

You can review the Android Quality Guidelines in the Quality guidelines page of the Android developers website.

63
Q

What is Data Binding?

A

The Data binding library helps you bind UI components in your layouts to data sources in your app. It uses a declarative format.

64
Q

19) What is ANR?

A

ANR is short for Application Not Responding. This is actually a dialog that appears to the user whenever an application have been unresponsive for a long period of time.

65
Q

15) What is the importance of Android in the mobile market?

A

Developers can write and register apps that will specifically run under the Android environment. This means that every mobile device that is Android enabled will be able to support and run these apps. With the growing popularity of Android mobile devices, developers can take advantage of this trend by creating and uploading their apps on the Android Market for distribution to anyone who wants to download it.

66
Q

32) Enumerate the steps in creating a bounded service through AIDL.

A
  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 methods.
  3. expose the interface, which involves implementing the service to the clients
67
Q

What is RecyclerView Adapter?

A

The RecyclerView Adapter tells the RecyclerView what to display in each ViewHolder.

68
Q

13) What are containers?

A

Containers, as the name itself implies, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples.

69
Q

40) When is the best time to kill a foreground activity?

A

The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.

70
Q

What Is ViewModel?

A

ViewModel is a class that stores the data from your UI. Because it’s aware of the app’s lifecycle, ViewModel is able to persist UI data through configuration changes, such as screen rotations.

71
Q
  1. What is Google Android SDK? Which are the tools placed in Android SDK?
A

Android Emulator - Android Emulator is a software application that simulates Android devices on your computer so that you can test the application on a variety of devices and Android API levels without having each physical device.
DDMS(Dalvik Debug Monitoring Services) - It is a debugging tool from the Android software development kit (SDK) which provides services like message formation, call spoofing, capturing screenshots, etc.
ADB(Android Debug Bridge) - It is a command-line tool used to allow and control communication with the emulator instance.
AAPT(Android Asset Packaging Tool) - It is a build tool that gives the ability to developers to view, create, and update ZIP-compatible archives (zip, jar, and apk).

72
Q

26) Is there a case wherein other qualifiers in multiple resources take precedence over locale?

A

Yes, there are actually instances wherein some qualifiers can take precedence over locale. There are two known exceptions, which are the MCC (mobile country code) and MNC (mobile network code) qualifiers.

73
Q

24) Enumerate the three key loops when monitoring an activity

A

Entire lifetime – activity happens between onCreate and onDestroy
Visible lifetime – activity happens between onStart and onStop
Foreground lifetime – activity happens between onResume and onPause

74
Q

36) What is AIDL?

A

AIDL, or 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.

75
Q

25) When is the onStop() method invoked?

A

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.

76
Q

Where Do You Organize Your Tests in Android?

A

When you create an Android Studio project, you create two directories for testing:

The test directory is for unit tests that run locally. Usually, the JVM runs these tests.
The androidTest directory is for tests that run on devices. You’ll use this directory for other kinds of tests, such as integration tests and end-to-end tests.

77
Q

9) What are Intents?

A

Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.

78
Q

What Is Room?

A

Room is a persistence library built over SQLite to help you create databases more easily. Room uses caching to persist your app’s data locally. This provides the app with consistent data, regardless of internet connectivity.

79
Q

What Is the Navigation Component?

A

The navigation component is a framework that controls navigation within an Android app. It manages the back stack. It also handles functions with different controls, such as the app bar or drawers. The navigation component helps you provide a consistent user experience by enforcing established navigation principles.

80
Q

7) What is adb?

A

Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.