Last active
February 25, 2018 19:22
-
-
Save oatpano/796761d4a5596ed49dfaa0275d332e32 to your computer and use it in GitHub Desktop.
GetJsonFixModelClassKotlin
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 MyDataModel Context.getJsonFixModelClassKotlin(@RawRes jsonFileRes: Int): MyDataModel { | |
val inputStream = this.resources.openRawResource(jsonFileRes) | |
val bufferReader = BufferedReader(InputStreamReader(inputStream)) | |
return gson.fromJson(bufferReader, MyDataModel::class.java) | |
} | |
// วิธีเรียกใช้ | |
getJsonFixModelClassKotlin(R.raw.json_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment