How to add/get the internal application data?
If i have a file in /data/data//files开发者_C百科/data.dat, how to get the data.dat file ? To get it i maked this:
File f1 = new File("data/data/carburant.android.com/files/data.dat");
InputStream in = new FileInputStream(f1);
I know it's not 100% coorect ? how to correct it? and how to add a file in this path?
Thank you very much.
Option #1: Call openOutputStream("data.dat");
Option #2: Call new File(getFilesDir(), "data.dat");
to use getFilesDir()
Option #3: Call getFileStreamPath("data.dat");
精彩评论