List of usage examples for android.media MediaScannerConnection scanFile
public void scanFile(String path, String mimeType)
From source file:com.frostwire.android.gui.UniversalScanner.java
private static void onMediaScannerConnected(MediaScannerConnection connection, Collection<File> files) { if (files == null || connection == null) { return;// w w w . j a v a2s. com } try { /* should only arrive here on connected state, but let's double check since it's possible */ if (connection.isConnected() && !files.isEmpty()) { for (File f : files) { connection.scanFile(f.getAbsolutePath(), null); } } } catch (IllegalStateException e) { LOG.warn("Scanner service wasn't really connected or service was null", e); //should we try to connect again? don't want to end up in endless loop //maybe destroy connection? } }