2013年5月22日 星期三

read_ex()


protected String read_ex(String string, String string2) {
// TODO Auto-generated method stub
File sdcard = new File(Environment.getExternalStorageDirectory() + "/"
+ string);

// Get the text file
File file = new File(sdcard, string2);

// Read text from file
StringBuilder text = new StringBuilder();

try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line;

while ((line = br.readLine()) != null) {
text.append(line);
text.append('\n');
}
} catch (IOException e) {
// You'll need to add proper error handling here
}
return text.toString().substring(0, text.toString().length() - 1);
}

沒有留言:

張貼留言

Related Posts Plugin for WordPress, Blogger...