Using the scene, there are some text files under the Assert folder that we need to read through the tool class and put into string strings, how do we do it:
Directly on the code:
Public Staticstring Readassertresource (context context, String Strassertfilename) {Assetmanager Assetmanager=context.getassets (); String Strresponse= ""; Try{InputStream IMS=Assetmanager.open (strassertfilename); Strresponse=Getstringfrominputstream (IMS); } Catch(IOException e) {e.printstacktrace (); } returnstrresponse; } Private StaticString Getstringfrominputstream (InputStream a_is) {bufferedreader br=NULL; StringBuilder SB=NewStringBuilder (); String Line; Try{br=NewBufferedReader (NewInputStreamReader (a_is)); while(line = Br.readline ())! =NULL) {sb.append (line); } } Catch(IOException e) {}finally { if(BR! =NULL) { Try{br.close (); } Catch(IOException e) {}}} returnsb.tostring (); }}Complete. It's ready to flash. Go Go Go
How Android reads txt text in the Assert folder and becomes a string