Context Open file
import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import android.content.Context; class Common { public static String ReadFileData(Context context, String fileName) { String strValue = null; File file = context.getFileStreamPath(fileName); if (file.exists()) { StringBuilder sb = new StringBuilder(); BufferedReader bufferReader = null; try { // ?????????????buffer?? bufferReader = new BufferedReader(new InputStreamReader( context.openFileInput(fileName))); String strLine = null; while ((strLine = bufferReader.readLine()) != null) { sb.append(strLine); } } catch (Exception e) { e.printStackTrace(); } finally { try { bufferReader.close(); } catch (IOException e) { e.printStackTrace(); } } strValue = sb.toString(); } return strValue; } }