Scan file from MediaScannerConnection - Android Network

Android examples for Network:Network Connection

Description

Scan file from MediaScannerConnection

Demo Code


//package com.java2s;
import java.io.File;

import android.content.Context;

import android.media.MediaScannerConnection;
import android.os.Environment;

public class Main {
    public static void updateGarally(Context context, String fileName) {

        String mimeType = "image/jpeg";

        ////  ww w  .  j a  va 2s.c o  m
        File file = new File(Environment.getExternalStorageDirectory(),
                fileName);

        MediaScannerConnection.scanFile(
                context, // Context
                new String[] { file.getPath() }, new String[] { mimeType },
                null);
    }
}

Related Tutorials