Created
June 12, 2017 08:40
-
-
Save francisnnumbi/4b815d084debc69209b8e5f10cecc387 to your computer and use it in GitHub Desktop.
#ANDROID Reading simple and plain text from assets folder.
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
/** reading plain text from assets folder */ | |
public static String loadText(Context ctx, String address){ | |
String _data = ""; | |
try{ | |
InputStream is = ctx.getAssets().open(address); | |
int size = is.available(); | |
byte[] buffer = new byt[size]; | |
is.read(buffer); | |
is.close(); | |
_data = new String(buffer); | |
}catch(IOException ioe){} | |
return _data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment