I have to make an app where I have to show a map (I'm using Osmdroid) and read a text file that has a list of geographic coordinates. I have to read a pair of latitude and longitude and show it on the map, and after one second read the next pair and show it on the map, and so on.
I was thinking of reading the file in a Thread
, but I found that I can't do anything with the user interface in a Thread
, so I guess I wouldn't be able to show the location on the map.
Then I found that with an AsyncTask
I could modify the user interface but in the documentation says that it is for short tasks, and what I want to do may take many minutes.
In the AsyncTask
documentation says If you need to keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent package such as Executor, ThreadPoolExecutor and FutureTask, but I don't know when to use those classes and if one of them (or any other) would help me to do what I want: read a line of the text file and show the location on the map.