Skip to content

Instantly share code, notes, and snippets.

@francisnnumbi
Created June 12, 2017 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francisnnumbi/4b815d084debc69209b8e5f10cecc387 to your computer and use it in GitHub Desktop.
Save francisnnumbi/4b815d084debc69209b8e5f10cecc387 to your computer and use it in GitHub Desktop.
#ANDROID Reading simple and plain text from assets folder.
/** 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