Guys, I have a text file on an SD card, I need to read this file.
Below is my code for reading files:
File f = new File(Environment.getExternalStorageDirectory()+"/f1.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){ textdata.setText(readString); Log.d("line: ", readString); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e){ e.printStackTrace(); }
But I need to dynamically read files from the SDK.
here i gave it as f1.txt
Goofy source share