scan File By Intent - Android Intent

Android examples for Intent:Open File

Description

scan File By Intent

Demo Code


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

import android.content.Context;
import android.content.Intent;

import android.net.Uri;

public class Main {

    public static void scanFileByIntent(Context context, String path) {
        scanFileByIntent(context, new File(path));
    }/*from w w w  .  ja  v  a  2s  . com*/

    public static void scanFileByIntent(Context context, File file) {
        Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
        intent.setData(Uri.fromFile(file));
        context.sendBroadcast(intent);
    }
}

Related Tutorials