Created
December 8, 2021 16:12
-
-
Save sunwicked/819e777af66ecb9c0ed7dc8b2b8258f8 to your computer and use it in GitHub Desktop.
readFileDataFromAsset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun readFileDataFromAsset(context: Context, fileName: String): String? { | |
val data: String? = null | |
try { | |
data = context.assets.open(fileName).bufferedReader().use { it.readText() } | |
} catch (ioException: IOException) { | |
ioException.printStackTrace() | |
return null | |
} | |
return data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment