Skip to content

Instantly share code, notes, and snippets.

@codesburner
Forked from mstefanko/read .txt file
Created April 5, 2011 08:21
Show Gist options
  • Save codesburner/903239 to your computer and use it in GitHub Desktop.
Save codesburner/903239 to your computer and use it in GitHub Desktop.
try{
File f = new File(Environment.getExternalStorageDirectory()+"/myFile.txt");
fileIS = new FileInputStream(f);
BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
String readString = new String();
//just reading each line and pass it on the debugger
while((readString = buf.readLine())!= null){
Log.d("line: ", readString);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment