Android: FileReader unexpectedly throwing FileNotFoundException -


So I'm unexpectedly receiving a FileNotFoundException as you can see, before I call FileReader, I call FileInputStream which works fine. I have tried to put the filereader in my try / catch clause, but get the same result. I left the unnecessary lines for my question from this section (ultimately I also call LineNumberReader, although I removed it from the block because I am not even so far away.)

  string file name = "file.txt"; Try {byte [buffer = new byte] [128]; String tocet = new string (); TextViewView = (TextView) findViewById (R.id.textview); FileInputStream fis = openFileInput (FILENAME); The ///// file was found successfully here. Fis.close (); ToStr = new string (buffer); View.append (toStr); FileReader fr = New FileReader (FILENAME); ///// FileNotFoundExceptionThrownHere ////////// The stuff is here ///// fr.close (); } Hold (FileNotFoundException E) {TextViewView = (TextView) findViewById (R.id.textview); View.append ("File not found!"); } Grip (IOE EXPRESS E) {Text View View = (TextView) SearchWBIID (RIDTEXView); View.append ("Io error!"); }   

In addition to this, please note that whenever it comes to Java, I am a newbie right now. I have experience in some other languages, but Java is a bit of a different breed of monster for me. Any help would be greatly appreciated!

openFileInput () and new FileReader () Do not take the same parameters.

openFileInput ("file.txt") is equal to new FileReader (new file (getFilesDir ()), "file.txt")) .

Comments