Sd Card Data Sometimes Not Seen On Pc When Connected In Usb Mass Storage Mode (via Phone)
Possible Duplicate: SDCard content exist but cant see them Phone running Linux Kernel(2.6.31) with SD card inserted. [ISSUE] When data is written to SD card (write syscall) the
Solution 1:
Your problem is an exact duplicate of SDCard content exist but cant see them - the PC is displaying the content as returned from the MTP interface.
Stub code to do what you need to make the file appear:
imports:
import android.media.MediaScannerConnection;
import android.os.Environment;
import android.util.Log;
import java.io.File;
stub code:
File f = new File(Environment.getExternalStorageDirectory().getPath() + "/hello_nurse.txt");
if (! f.exists()) {
try {
f.createNewFile();
String[] files = newString[1];
files[0] = Environment.getExternalStorageDirectory().getPath() + "/hello_nurse.txt";
String[] mimes = newString[1];
mimes[0] = "text/plain";
MediaScannerConnection.scanFile(getApplicationContext(), files, mimes, null);
} catch (Exception ex) {
Log.e("SD Create", "Failed to create file", ex);
return;
}
} else {
Log.e("SD Create", "File is already present");
}
Post a Comment for "Sd Card Data Sometimes Not Seen On Pc When Connected In Usb Mass Storage Mode (via Phone)"