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 query(Context context, Uri uri) {
        if (context == null || uri == null)
            return "";
        Cursor cursor = context.getContentResolver().query(uri,
                new String[] { MediaStore.Images.ImageColumns.DATA }, null, null, null);
        cursor.moveToNext();
        return cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA));
    }
}