比如我们用MediaScannerConnection扫描我们保存文件到SD卡的文件时:
/**
* Requests the media scanner to scan a file.
* Success or failure of the scanning operation cannot be determined until
* {@link MediaScannerConnectionClient#onScanCompleted(String, Uri)} is called.
*
* @param path the path to the file to be scanned.
* @param mimeType an optional mimeType for the file.
* If mimeType is null, then the mimeType will be inferred from the file extension.
*/
public void scanFile(String path, String mimeType) {
synchronized (this) {
if (mService == null || !mConnected) {
throw new IllegalStateException("not connected to MediaScannerService");
}
try {
if (false) {
Log.v(TAG, "Scanning file " + path);
}
mService.requestScanFi