/* Read the file from the raw folder (created in the res directory )*/
Public String getfromraw () {string result = ""; inputstream in = NULL; try {In = getresources (). openrawresource (R. raw. test1);/* read the file from the raw folder without the suffix */INT Len = in. available (); byte [] MSG = new byte [Len]; In. read (MSG); Result = encodingutils. getstring (MSG, encoding);} catch (notfoundexception e) {e. printstacktrace ();} catch (ioexception e) {e. printstacktrace ();} finally {If (in! = NULL) {try {in. Close ();} catch (ioexception e) {e. printstacktrace () ;}} return result ;}
/* Read the file from the assets folder */Public String getfromassets (string filename) {string result = ""; inputstream in = NULL; try {In = getresources (). getassets (). Open (filename );/* Obtain the file from the assets folder */INT Len = in. available (); byte [] MSG = new byte [Len]; In. read (MSG); Result = encodingutils. getstring (MSG, encoding);} catch (notfoundexception e) {e. printstacktrace ();} catch (ioexception e) {e. printstacktrace ();} finally {If (in! = NULL) {try {in. Close ();} catch (ioexception e) {e. printstacktrace () ;}} return result ;}