Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import android.media.MediaScannerConnection;
import android.net.Uri;

import android.util.Log;

public class Main {
    public static void addPhotoToMediaStoreSynchronously(Context context, Uri uri) {
        MediaScannerConnection.scanFile(context, new String[] { uri.getPath() }, new String[] { "image/*" },
                new MediaScannerConnection.OnScanCompletedListener() {
                    public void onScanCompleted(String path, Uri uri) {
                        Log.i("MediaStore", "Scanned " + path + ":");
                        Log.i("MediaStore", "-> uri=" + uri);
                    }
                });
    }
}