Arman Kolahan

TV app is becoming a trend in some businesses and its demand is increasing due to growth of smart TV users. One of the biggest shares of operating systems in smart TVs is Android.

Android TV and Fire TV

When you google developing an android tv app, you can just find the Leanback default theme…

In this article, we start discussing the syntax in Kotlin programming language.

Package and Import

Package declaration

In the first line of each file, the package name should be declared:

package my.demo

It should be mentioned that it is not mandatory matching the package name with the folder name.

Import

The next lines after the package…

The main Integrated Development Environment (IDE) for developing Kotlin is IntelliJ IDEA, which is an open-source and free (Community Edition) IDE developed by JetBrains, the company that designed and developed Kotlin.

Step 1. Create the first project

First, in IntelliJ IDEA click on the new project.

Click on the new project

Step 2. Create a Kotlin JVM project

Kotlin is a statically-typed programming language that is designed and developed by JetBrains. It is a cross-platform language that targets the JVM, Android, JavaScript, and Native.

Features

Less Code (compared to Java)

Kotlin compare to Java is more concise, and you need to write fewer lines of code, which helps to increase the readability.

Interoperable with Java

Kotlin is…

Model-View-Presenter (MVP) is a derivation of the Model-View-Controller (MVC) architecture, which is a common architectural pattern in android development. As its name expressed, it contains three sections, namely Model, View, and Presenter.

Definitions

Model

If you have experience working with code architecture, undoubtedly you heard Model. The model is the central component…

Crashes are nightmares of programmers. Change nightmares to dreams by switching from Java to Kotlin in Android development.

Java was for many years the official language of Android development. And the most common reason for crashes was NullPointerException. It was very difficult to handle null safety in java codes until…

It was one of my problems, how to design nested vertical RecyclerView inside ScrollView in Android. The answer is:

androidx.core.widget.NestedScrollView

It should be mentioned that in this case, the RecyclerView is NOT the RecyclerView anymore!

In the first step, you need to create NestedScrollView element in XML:

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

// RecyclerViews should be located here

</LinearLayout>
</androidx.core.widget.NestedScrollView>

Next, add the below attribute to recyclerView:

android:overScrollMode="never"

Then, the recyclerView will be as following:

<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never" />

Finally, the whole the layout will be something like below, you can add other materials inside LinearLayout:

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never" />
// other materials </LinearLayout>
</androidx.core.widget.NestedScrollView>

Arman Kolahan

I am an android and web developer, mainly working on Kotlin, JavaScript, PHP, and Java.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store