Skip to main content

Posts

Showing posts with the label read text file

How to read text file from sdcard in android

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 Play audio from sdcard Play video from sdcard How to read image from sdcard