Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.database.Cursor;

import android.net.Uri;

import android.provider.MediaStore;

public class Main {

    public static String getImageAbsolutePath(Context context, Uri uri) {
        Cursor cursor = MediaStore.Images.Media.query(context.getContentResolver(), uri,
                new String[] { MediaStore.Images.Media.DATA });
        if (cursor.moveToFirst()) {
            return cursor.getString(0);
        }
        return null;
    }
}