Nov.12

Interview: Android – Reference

Dagger: Dagger is a fully static, compile-time dependency injection framework. It supports Android and Java. It is created by Square.


Butter Knife: Butter Knife is a view binding tool that uses annotations to generate boilerplate code for developers. It is developed by Jake Wharton.


RxAndroid: RxJava bindings for Android which is a library for composing asynchronous and event-based programs by using observable sequences.


Retrofit: Retrofit is a REST Client for Java and Android which makes it relatively easy to retrieve and upload data via a REST based web service. Retrofit turns HTTP API into a Java interface.


OkHTTP: OkHTTP is an open source efficient HTTP client. It supports SPDY protocol which is basis for HTTP 2.0 and allows multiple HTTP requests to be multiplexed over one socket connection. It is created by Square.


AutoValue: AutoValue concept is very simple – we write an abstract class, and @AutoValue implements it. There is literally no configuration.


Gson and Moshi: Gson and Moshi are JSON serialization and deserialization libraries. Moshi is created by Square.


Picasso: Picasso is a powerful image downloading and caching library for Android. It is created by Square.


Glide: Glide is a fast and efficient open source media management and image loading framework for Android focused on smooth scrolling. It wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.


Realm: Realm is a lightweight database that can replace both SQLite and ORM libraries. It is faster in performance and has lots of modern features, like JSON support, a fluent API, data change notifications, and encryption support.


SQLBrite: SQLBrite is a lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations. In other words, our database can be observable. It is developed by Square.


Timber: Timber is a small and extensible utility library built on top of Android’s normal Log class. It is created by Jake Wharton.

Android,Reference,Interview

Nov.08

Interview: Android – Storage

Question: What is Persistent Storage?

Persistent Storage is any data storage device that retains data after turning-off power. It is also sometimes refers to non-volatile storage.


Question: What is SharedPreferences?

SharedPreferences is a library from Android which allows to save and retrieve data in the form of key-value pair in a application. It stores data persistently.


Question: What is SQLite?

SQLite is a opensource SQL database that provides a relational database management system. It stores data in a text file on a device. Android comes in with built-in SQLite database.


Question: What is Room?

Room provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite. It is an ORM (Object Relational Mapper) for SQLite database in Android.

Android,Storage,Interview

Nov.08

Interview: Android – Network

Question: What are HTTP Client and REST Client?

HTTP Client is a client which is able to send requests and get responses from server in HTTP format.

REST Client is a client which is designed to use services from servers. These services are RESTFUL and use HTTP protocols.


Question: What is Parsing JSON?

Parsing = Interpreting.
JSon = Format specification.

Parsing JSON means interpreting data with a programming language.


Question: What is JSON Serialization/Deserialization?

JSON is a format that encode objects in a string.

Serialization means converting an object into a string and deserialization means converting a string into an object.


Question: What are Push Notifications?

Notification is a message that pops up on the user’s device. Notifications can be triggered locally by an open application, or they can be “pushed” from the server to the user even when the app is not running.

Push Notifications are assembled using two APIs: Notifications API and Push API. Notifications API lets the app display system notifications to the user. Push API allows a service worker to handle Push Messages from a server, even while the app is not active.

Android,Network,Interview

Nov.07

Interview: Android – Architecture

Question: What is MVC?

MVC (Model–View–Controller) is a software design pattern commonly used for developing user interfaces which divides the related program logic into three interconnected elements.

Model represents dynamic data structure, logic and rules, independent of the user interface.

View is any representation of information such as a chart, diagram or table.

Controller accepts input and converts it to commands for the model or view.


Question: What is MVP?

MVP (Model–View–Presenter) is a derivation of the MVC (Model–View–Controller) architectural pattern, and is used mostly for building user interfaces.

Model is an interface defining the data to be displayed or otherwise acted upon in the user interface.

View is a passive interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data.

Presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view.


Question: What is MVVM?

MVVM (Model-View-ViewModel) is a software design pattern which facilitates a separation of development of the graphical user interface from development of the business logic or back-end logic (the data model). The viewmodel is a value converter, meaning the viewmodel is responsible for exposing (converting) the data objects from the model in such a way that objects are easily manageable or presentable.

Model refers either to a domain model, which represents real state content (object-oriented approach), or to the data access layer, which represents content (data-centric approach).

View is a passive interface that displays data (the model) and routes user commands (events) to the viewmodel to act upon that data.

ViewModel converts model information into values that can be displayed on a view. MVVM uses binder, which automates communication and synchronization between the view and its bound properties in the viewmodel.


Question: What is MVI (Unidirectional Data Flow)?

MVI (Model-View-Intent) is a software design pattern which follow Unidirectional and Circular Data Flow. Any user interaction is processed by business logic which brings change in the state. Then this new state is rendered on view and presented to the user.

Model represents dynamic data structure, logic and rules, independent of the user interface. Model also holds state.

View is any representation of information such as a chart, diagram or table. Views can contain one or more intents.

Intent represents an intention or command to perform an action by the user. It does not represent “android.content.Intent”.

Android,Architecture,Interview

Nov.07

Interview: Android – Kotlin

Queston: What are Lambda Expressions and Anonymous Functions?

Lambda expressions and anonymous functions are ‘function literals’, i.e. functions that are not declared, but passed immediately as an expression.

Lambda expression is always surrounded by curly braces, parameter declarations in the full syntactic form go inside curly braces and have optional type annotations, the body goes after an -> sign. If the inferred return type of the lambda is not Unit, the last (or possibly single) expression inside the lambda body is treated as the return value.

Anonymous function looks very much like a regular function declaration, except that its name is omitted. Its body can be either an expression or a block. We can specify return type in anonymous function.


Question: What are Coroutines?

Coroutines are a new way of writing asynchronous, non-blocking codes (and much more). Coroutines are sort of tasks that threads can execute. Threads can stop executing coroutines at some specific “suspension points”, and go do some other work. Also threads can resume executing coroutines later on, or another thread could even take over.


Question: What are CoroutineContext and CoroutineDispatcher?

Coroutines always execute in some context represented by a value of the CoroutineContext type, defined in the Kotlin standard library. CoroutineContext is a set of various elements. The main elements are the job of the coroutine and its dispatcher.

Coroutine context includes a coroutine dispatcher that determines what thread or threads the corresponding coroutine uses for its execution. CoroutineDispatcher can confine coroutine execution to a specific thread, dispatch it to a thread pool, or let it run unconfined.


Question: What are GlobalScope and CoroutineScope?

GlobalScope is used to launch top-level coroutines which are operating on application lifetime and are not cancelled prematurely.

CoroutineScope defines a scope for new coroutines. Coroutine builders are extensions on CoroutineScope and inherit CoroutineContext to automatically propagate context elements and cancellation.


Question: What are Suspend functions?

Suspend functions are at the center of every coroutine. Suspend function is a function that can be paused and resumed at a later time. These functions can execute long running operations and wait to complete without blocking threads.


Question: What are runBlocking and coroutineScope?

runBlocking runs a new coroutine and blocks the current thread interruptibly until its completion. It is not a suspend function and should not be used from a coroutine.

coroutineScope is a suspend fun. When coroutine suspends, coroutineScope function suspends as well.


Question: What are async and launch?

launch starts fire-and-forget coroutine and it returns Job.

async starts coroutine which computes some results and it returns Deferred<*>.


Question: What is Deferred?

Deferred is a kind of analog of future which encapsulates an operation that will be finished at some point in future after it’s initialization.

Android,Kotlin,Interview

Nov.07

Interview: Android – Thread

Question: What is Asynchronous Programming?

Asynchronous programming is a form of parallel programming in which a unit of work runs separately from the main application thread and notifies the calling thread of its completion, failure or progress.


Question: What is Functional Programming?

Functional programming is a process of constructing software by composing pure functions. It avoid concepts of shared state, mutable data and other side-effects. It emphasize on expressions and declarations rather than execution of statements.


Question: What is the difference between AsyncTask and AsyncTaskLoader?

We use AsyncTask class to implement an asynchronous, long-running task on a worker thread. Worker thread is any thread which is not the main thread. AsyncTask uses local context and it destroys itself upon screen orientation changes.

AsyncTaskLoader is equivalent of AsyncTask. But it uses application context. Upon completion, results are automatically delivered to the main thread. Change of screen orientation doesn’t effect AsyncTaskLoader.


Question: What is IntentService?

IntentService is a base class for Services that handle asynchronous requests on demand. IntentService performs certain task in the background and once done, the instance of IntentService terminate itself automatically.


Question: What is RxJava?

RxJava is a Java VM implementation of ReactiveX (Reactive Extensions): a library for composing asynchronous and event-based programs by using observable sequences.

Android,Thread,Interview

Nov.07

Interview: Android – View

Question: What is Fragment?

Fragment represents behavior or portion of user interface in an activity. Fragment must always be hosted in an activity and the fragment’s lifecycle is directly affected by the host activity’s lifecycle. We can combine multiple fragments in a single activity and reuse a fragment in multiple activities.


Question: What are LinearLayout, RelativeLayout and ConstraintLayout?

LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. We can specify the layout direction with the android:orientation attribute.

RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements or in positions relative to the parent.

ConstraintLayout is use to define a layout by assigning constraints for every child view relative to other views. ConstraintLayout is similar to RelativeLayout, but with more power.


Question: What are view Re-usability and Optimization?

RecyclerView is a more advanced and flexible version of ListView. It is a ViewGroup which renders any adapter-based view. It uses recycle or reusable technology for rendering.

We should use custom styles derived from native styles, instead of using native styles directly.

Also we can use <include> tag in layouts to import other layouts. We should avoid creating same layout again and again.


Question: What is Material Design?

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. To use material design in Android apps, we should follow the guidelines defined in the material design specification and use the new components and styles available in the material design support library.

Android,View,Interview

Nov.07

Interview: Android – Core

Question: What is Context?

Context 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-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.


Question: What is Gradle?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing us to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of our application.


Question: What is Activity?

Activity represents a single screen with a user interface. An Android application may contain one or more activities.

Lifecycle of activity:
onCreate() is called when activity is first created.
onStart() is called when activity is becoming visible to the user.
onResume() is called when activity will start interacting with the user.
onPause() is called when activity is not visible to the user.
onStop() is called when activity is no longer visible to the user.
onRestart() is called after your activity is stopped, prior to start.
onDestroy() is called before the activity is destroyed.


Question: What is ARMv7?

ARMv7 is optimized for battery consumption. ARM64 is an evolution of the original ARM architecture which supports 64-bit processing. ARMx86 is not battery friendly but it is more powerful than others.


Question: What are DVM and JVM?

DVM = Dalvik Virtual Machine.
JVM = Java Virtual Machine.

Android uses DVM which runs on low memory. DVM uses own byte code and runs .dex file.


Question: What are App Components?

App Components are the essential building blocks. Each component is an entry point through which the system or a user can enter our app. Some components depend on others.

Each component we create must declare a corresponding XML element in the manifest file.

There are four types of app components:
<activity> for each subclass of Activity.
<service> for each subclass of Service.
<receiver> for each subclass of BroadcastReceiver.
<provider> for each subclass of ContentProvider.

Android,Core,Interview