get Input Stream By Uri - Android android.net

Android examples for android.net:Uri

Description

get Input Stream By Uri

Demo Code

import java.io.InputStream;

import android.content.Context;
import android.net.Uri;

public class Main {

  public static InputStream getInputStreamByUri(Context context, Uri uri) {
    try {// ww w  . ja  v a2s .  c  o  m
      return context.getContentResolver().openInputStream(uri);
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }

}

Related Tutorials