Skip to content

Instantly share code, notes, and snippets.

@mstefanko
Created March 28, 2011 13:23
Show Gist options
  • Select an option

  • Save mstefanko/890435 to your computer and use it in GitHub Desktop.

Select an option

Save mstefanko/890435 to your computer and use it in GitHub Desktop.

Revisions

  1. mstefanko created this gist Mar 28, 2011.
    24 changes: 24 additions & 0 deletions read .txt file
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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();

    }