Read text files from Assets in Android

Daniyar
1 min readOct 7, 2020

Add *.txt file to Asset folder:

Text inside the file can be random

Create layout with TextView:

In MainActivity add this code:

git link

Bonus:

Parse JSON formatted data (git)

Add this function, which will parse from data.json file:

In onCreate() change the code:

And add data.json file to Asset folder:

--

--

Daniyar

Ex- Google Certified Associate Android Developer