Advertisement
Narzew

[Android] File Read Function Error

Nov 15th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1.     public String file_read(String filename){
  2.         InputStream input;
  3.         String text = "";
  4.         try {
  5.             AssetManager assetManager = getAssets();
  6.             input = assetManager.open(filename);
  7.             int size = input.available();
  8.             byte[] buffer = new byte[size];
  9.             input.read(buffer);
  10.             input.close();
  11.             text = new String(buffer);
  12.         } catch(IOException e){
  13.             e.printStackTrace();
  14.         }
  15.         return text;
  16.     }
  17.  
  18. ______________________________________________________________________________________
  19. HTTP://ANONTHING.PL
  20. HTTP://HACKTUT.UGU.PL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement