Your problem is an exact copy of the contents of the SDCard, but they are not visible - the PC displays the contents returned from the MTP interface.
The stub code to do what you need to create the file:
Import
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 = new String[1]; files[0] = Environment.getExternalStorageDirectory().getPath() + "/hello_nurse.txt"; String[] mimes = new String[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"); }
Petesh
source share