私はファイルを持っています
String filename="MEMS.backup";
これを使用して保存します:
InputStream myInput;
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard, "Myfolder");
try {
myInput = new FileInputStream(MyApplication.getAppContext().getFilesDir().getParentFile().getPath()+"/databases/MEMS");
// Create the folder if it doesn't exist:
if (!directory.exists())
{
directory.mkdirs();
}
OutputStream myOutput = new FileOutputStream(directory.getPath()+
filename);
そしてこれをロードします:
OutputStream myOutput;
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard, "Myfolder");
try {
myOutput= new FileOutputStream(MyApplication.getAppContext().getFilesDir().getParentFile().getPath()+"/databases/MEMS");
InputStream myInputs = new FileInputStream(directory.getPath()+filename);
問題は、sdcard に「Myfolder」を作成するが、空であることです。
そして、ファイル「MEMS」はsdcardに入れられます(Myfolderにあるはずです)。
また、ファイルの名前は MEMS ではなく MyfolderMEMS です。
私は自分の間違いを理解できません。