Skip to content

Instantly share code, notes, and snippets.

@mstefanko
Created March 28, 2011 13:23
Show Gist options
  • Save mstefanko/890435 to your computer and use it in GitHub Desktop.
Save mstefanko/890435 to your computer and use it in GitHub Desktop.
read .txt file from android
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