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.ContentResolver;

import android.content.Context;

import android.net.Uri;

import android.util.Log;

import java.io.FileNotFoundException;

import java.io.InputStream;

public class Main {
    private static final String TAG = "junu";

    public static InputStream getISFromURI(Context context, Uri contentURI) {
        ContentResolver res = context.getContentResolver();
        Uri uri = Uri.parse(contentURI.toString());
        InputStream is = null;
        try {
            is = res.openInputStream(uri);
        } catch (FileNotFoundException e) {
            jlog(e);
        }

        return is;
    }

    public static void jlog(String s) {
        Log.i(TAG, s);
    }

    public static void jlog(Object o) {
        Log.i(TAG, o.toString());
    }
}