In the previous tutorial we have dealt with static list in the same way we will go through the mostly used, user friendly list type called as dynamic list.

The key feature of dynamic listing is to allow the user to add the values and remove them from any order in the list.For example this type of list is mostly used in the situations where we are expecting dynamic inputs.

When ever you want to take a list of inputs from user we mainly use these dynamic list.

As like static list dynamic also supports different datatype’s

Let’s see a sample list declaration of type Integer



Android Kotlin Tutorial on Static List || List in Kotlin



What’s the need of dynamic list?

When you are about to display a random data under a single collection or in a list type the best way is to implement dynamic listview.

1) Flexible in inserting and deleting elements.

2) Need not predefine values

3) Supports various methods like sorting, cloning and many more using which we can maintain values accordingly



Let’s see how the dynamic list is declared in different data types.



Declaring a dynamic list of type Integer


adding values into list



String type dynamic list


adding String’s into list




Declaring a double type list


Adding values into the list



As discussed in the Static list tutorial all the methods are even supported in dynamic list’s may refer previous tutorial.


Show Buttons
Hide Buttons
Read previous post:
Android Kotlin Tutorial on Static List || List in Kotlin