Program to read text file from sdcard
To read a text file from sdcard, first create an object of FileInputStream class. Set the path of text file in the constructor of FileInputStream. Declare a byte array to read the file. Then call the read method.
FileInputStream Fin=new FileInputStream("sdcard/"+s); byte[] b=new byte[100]; t=(TextView)findViewById(R.id.textView1); Fin.read(b); text=new String(b); t.setText(text); Fin.close(); |
See more
Comments
Post a Comment