One strange and unpleasant thing. Sometimes
Using java Syntax Highlighting
FileOutputStream fos = openFileOutput(name, MODE);
Parsed in 0.029 seconds, using
GeSHi 1.0.8.4
does not work and causes
FileNotFoundException. It depends on application. Code from
plusminus works itself very well. But when I copy this code directly to
onCreate() method in my application, it stops works and
FileNotFoundException appears. Small examination with debugger shows, that exception has
detailMessage member with diagnostics for example
"/files/samplefile.txt" I.e. for some reason, application sets data path as
/files/ instead
/data/data/your_project_package_structure/files/ . It is very likely, that it is
SDK bug. Now I work to find out conditions, when it appears. If we take
plusminus code, and change
Using java Syntax Highlighting
FileInputStream fIn = openFileInput("samplefile.txt");
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
to
Using java Syntax Highlighting
FileInputStream fIn = openFileInput("samp__lefile.txt");
Parsed in 0.033 seconds, using
GeSHi 1.0.8.4
for example,
FileNotFoundException appears, because we write file
samplefile.txt, but try to read from
samp__lefile.txt.
We can see it's
detailMessage: "/data/data/org.anddev.android.workingwithfiles/files/samp__lefile.txt". I.e. in this case data path is correct:
/data/data/org.anddev.android.workingwithfiles/files/ Now I try to destroy
plusminus example to obtain this bug in pure, and will write about my results later.
P.S. About prefixes. Many peoples ask it.
It do not works !!!. Guys, please,
READ DOCUMENTATION !!!. You'll save and your and others time

See Context.openFileOutput() doc for example:
public abstract FileOutputStream openFileOutput(String name, int mode)
Open a private file associated with this Context's application package for writing. Creates the file if it doesn't already exist.
Parameters
name The name of the file to open; can not contain path separators.
mode Operating mode. Use 0 or MODE_PRIVATE for the default operation, MODE_APPEND to append to an existing file, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.
Returns
* FileOutputStream Resulting output stream.
Throws
FileNotFoundException java.io.FileNotFoundException Another cool thing is a debugger. If you add in
plusminus example path prefix, i.e. write
Using java Syntax Highlighting
FileOutputStream fOut = openFileOutput("/data/data/org/anddev.android.workingwithfiles/files/samplefile.txt", MODE_WORLD_READABLE);
Parsed in 0.037 seconds, using
GeSHi 1.0.8.4
FileNotFoundException appears. See with debugger it's
detailMessage member. You'll see text:
"File /data/data/org/anddev.android.workingwithfiles/files/samplefile.txt contains a path separator" And can understand, that path prefix is not allowed in filename.