In this example will be shown how to parse text file in to data objects and use the data where needed. The example is separated in two classes MainActivity and Library data transfer object (DTO) to map that line.

This was the parser that was used in solving the example of HashCode 2020 qualification round.

This is the txt file that we will use in our example. It must go in assets folder under app/src/main/assets. If you don`t see this folder, simply create it by clicking right click on main and then New->Directory and name it assets (use low letter). There paste the text file a_example.txt.

This example shows how to read two lines simultaneously from text.

And here is the Library Model for transferring data:




Spread the love

Leave a Reply

Your email address will not be published.