Java tutorial
//package com.java2s; import java.io.File; import java.io.FileInputStream; import android.util.Log; public class Main { private static final String TAG = "Util"; public static String readFromFile(String path) { String str = null; if (path == null || path.trim().length() == 0) { return null; } File file = new File(path); if (file.exists() && file.isFile()) { int filelength = (int) file.length(); byte[] filecontent = new byte[filelength]; try { FileInputStream in = new FileInputStream(file); in.read(filecontent); in.close(); str = new String(filecontent, "UTF-8"); } catch (Exception e) { Log.v(TAG, "read file is error"); return null; } } return str; } }