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.net.Uri;

import java.io.IOException;
import java.io.InputStream;

public class Main {
    /**
     * Retrieves an image's stream by an URI object.
     * @param context The context of the activity.
     * @param uri The URI object.
     * @return The InputStream of the URI object.
     */
    public static InputStream fetchImage(Context context, Uri uri) throws IOException {
        return context.getContentResolver().openInputStream(uri);
    }
}