+ 3
How to get all the files which are stored with the help of FileOutputStream ?
i have an application in which i have stored data in text files on android device via FileOutputStream. FileOutputStream fout=openFileOutput("Addr.txt",MODE_PRIVATE); fout.write(c.getBytes()); now i want to show these files on a separate screen. i want to know how to fetch all these files which i have saved.
1 Antwort
+ 1
hello, you can use fileinputstream to read those file.
FileInputStream fin=new FileInputStream("Addr.txt");
int i=0;
while((i=fin.read())!=-1){
System.out.print((char)i);
}
fin.close();
but don't forget to wrap this code in try catch block as it throws exceptions.