Created
May 20, 2019 18:55
-
-
Save shishirthedev/49690dd1b555a61cc8d04a29a94721da to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public String getAssetJsonData(Context context, String jsonFileName) { | |
String json = null; | |
try { | |
InputStream is = context.getAssets().open(jsonFileName + ".json"); | |
int size = is.available(); | |
byte[] buffer = new byte[size]; | |
is.read(buffer); | |
is.close(); | |
json = new String(buffer, "UTF-8"); | |
} catch (IOException ex) { | |
ex.printStackTrace(); | |
return null; | |
} | |
Log.e("data", json); | |
return json; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment