How would i use the media scanner connection to make files visible to Android file transfer.
referring to a question here (https://stackoverflow.com/questions/15007139/android-file-transfer-cannot-see-a-folder-created-by-app)
currently im writing an app and just want to make sure the folder is there and if not create it. And ultimately the data in the folder will either need to be take out of the folder or more data added to it.
Thanks for the help a little confused with this scanner stuff.
File internalMemory = new File("/mnt/sdcard/FMCW File Archive");
if(internalMemory.exists() && internalMemory.isDirectory()) {
mFileList = internalMemory.listFiles();
}else{
createDirIfNotExist("/FMCW File Archive");
}
Below is the method
public static boolean createDirIfNotExist(String path) {
boolean ret = true;
File file = new File(Environment.getExternalStorageDirectory() + path);
if (!file.exists()) {
if (!file.mkdirs()) {
Log.e("TravellerLog :: ", "Problem creating Image folder");
ret = false;
}
}
return ret;
}
-Evan
以上就是So i stumbled upon something.... File scan Media scanner connection的详细内容,更多请关注web前端其它相关文章!