Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import android.content.ContentValues;
import android.content.Context;

import android.net.Uri;

import android.provider.MediaStore;

public class Main {
    public static void singleBroadcast(Context context, String filepath) {
        final int DIR_FORMAT = 0x3001; // directory
        Uri MediaUri = MediaStore.Files.getContentUri("external");
        ContentValues values = new ContentValues();
        values.put(MediaStore.MediaColumns.DATA, filepath);
        values.put("format", DIR_FORMAT);
        values.put(MediaStore.MediaColumns.DATE_MODIFIED, System.currentTimeMillis() / 1000);
        context.getContentResolver().insert(MediaUri, values);
    }
}