Here you can find the source of readTextFromUri(Context c, Uri uri)
public static String readTextFromUri(Context c, Uri uri) throws IOException
//package com.java2s; import android.content.Context; import android.net.Uri; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String readTextFromUri(Context c, Uri uri) throws IOException { InputStream inputStream = c.getContentResolver().openInputStream( uri);// w w w. ja v a 2s . c o m BufferedReader reader = new BufferedReader(new InputStreamReader( inputStream)); StringBuilder stringBuilder = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { stringBuilder.append(line); } inputStream.close(); reader.close(); return stringBuilder.toString(); } }