扫描指定文件新方法:MediaScannerConnection.scanFile

旧方法(失效): Intent.ACTION_MEDIA_SCANNER_SCAN_FILE

使用以下新方法:

MediaScannerConnection.scanFile(
      getApplicationContext(), 
      new String[]{file.getAbsolutePath()}, 
      null, 
      new OnScanCompletedListener() {
         @Override
         public void onScanCompleted(String path, Uri uri) {
            Log.v("grokkingandroid", 
                  "file " + path + " was scanned seccessfully: " + uri);
         }
      });

你可能感兴趣的:(扫描指定文件新方法:MediaScannerConnection.scanFile)