Hey guys, I need some help with reading the contents of a file. I have a plaintext file called 'test' in my app's files/ directory. I have this code to read it:
public String loadFile(String filename) { try { FileInputStream fis = openFileInput(filename); InputStreamReader in = new InputStreamReader (fis); String contents = ""; in.read(contents.toCharArray()); return contents; } catch(FileNotFoundException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } } I pass the filename to the function like this: String contents = ""; contents = loadFile('test'); But every time it returns nothing. I have tested it and it doesn't go into one of the catch es, but it apparently reads nothing from the file. What am I doing wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---