Skip to content

Instantly share code, notes, and snippets.

@AkshatAgrawal05
Last active August 25, 2017 09:52
Show Gist options
  • Save AkshatAgrawal05/21f999e50b7d749e86bf8d4bc8aceb62 to your computer and use it in GitHub Desktop.
Save AkshatAgrawal05/21f999e50b7d749e86bf8d4bc8aceb62 to your computer and use it in GitHub Desktop.
First Kotlin Project
fun getJsonFromAssets(): String? {
var json: String? = null
var inputStream: InputStream
inputStream = this.assets.open("reddit.json")
val size = inputStream.available()
val buffer = ByteArray(size)
inputStream.read(buffer)
inputStream.close()
json = String(buffer)
return json
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment