Java tutorial
//package com.java2s; import android.net.Uri; import java.io.*; public class Main { public static String readTextContent(Uri fileUri) { return readTextContent(fileUri.getPath()); } public static String readTextContent(String filePath) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(filePath)); StringBuilder sb = new StringBuilder(); while (reader.ready()) sb.append(reader.readLine()); return sb.toString(); } catch (FileNotFoundException e) { // e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; } }