图片扫描,加入媒体库

2017-08-22  本文已影响11人  已经死去的猫

参考链接 http://droidyue.com/blog/2014/07/12/scan-media-files-in-android-chinese-edition/

public void mediaScan(File file) {
        MediaScannerConnection.scanFile(this,
                new String[]{file.getAbsolutePath()}, new String[]{"image/*"},
                new MediaScannerConnection.OnScanCompletedListener() {
                    @Override
                    public void onScanCompleted(String path, Uri uri) {
                        Log.v("MediaScanWork", "file " + path
                                + " was scanned seccessfully: " + uri);
                    }
                });
    }
上一篇 下一篇

猜你喜欢

热点阅读