So I have thousands of coordinates that i need to plot and one of the best method i know is by saving the coordinates as .txt in asset folder and then pull it by using
val json_string = application.assets.open(file_name).bufferedReader().use{it.readText()}
But when the file is pulled, it read the file as a string, despite the file is saved in array format such as follow:
"97.951476367000055,3.155017079000061","97.951800004000063,3.154406602000051","97.949325673000033,3.156145963000029","97.948721732000081,3.15657051200003","97.948646156000052,3.156623638000042","97.947494978000066,3.15786896100002","97.94724135000007,3.158143331000076","97.947000011000057,3.158404405000056","97.946790649000036,3.158630887000072","97.946272953000062,3.15919092200005","97.945702608000033,3.15980791000004","97.945553326000038,3.159969400000023","97.944601930000033,3.160998592000055","97.944409762000078,3.161206474000039"....
I want to read the asset in an array format, for example, it is divided by comma and grouped by quotes, for example:
- "97.951476367000055,3.155017079000061"
- "97.951800004000063,3.154406602000051"
- "97.949325673000033,3.156145963000029"
- and so on...
How can I read this .txt file asset as string array or ArrayList< String > format in Kotlin?
Thanks!

Create a model like below
// Function to read coordinates from the asset file and convert to ArrayList
Your text file should be like the below format
coordinate.txt
You can call the method as