-3

I am changing the string constant of a file name from InternalString to Location. This is causing the following errors:

12-01 12:58:47.555: W/System.err(6405): java.io.FileNotFoundException: /data/data/com.example.app3/files/Location: open failed: ENOENT (No such file or directory)

code causing error:

String FILENAME = "Location";

try {
    InputStream fis = openFileInput(FILENAME);
    byte[] dataArray = new byte[fis.available()];
    while (fis.read(dataArray) != -1)
    {
        String text = new String(dataArray);
        tvCoordinates = (TextView) findViewById(R.id.tvcoordinates);
        tvCoordinates.setText(text);
    }

} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

1 Answers1

1

java.io.FileNotFoundException: /data/data/com.example.app3/files/InternalLocation

For one thing, InternalLocation != Location.

For another...does the file exist in this location already?

JstnPwll
  • 8,585
  • 2
  • 33
  • 56
  • location does not exist. This said I did not create InternalString neither. Is it created automatically? – Daniel Camilleri Dec 01 '14 at 18:11
  • Not by trying to read it, only if you are writing to it. If you attempt to read a missing file you will get a FileNotFoundException. – JstnPwll Dec 01 '14 at 18:17