For writing text files ========================================================================== outputFile = null; Create the file: File filePathInfo = new File(path, fileName); FileOutputStream outputFile = new FileOutputStream(filePathInfo, APPEND); Write the file: public int writeText(String txt) { int i; char[] ch = txt.toCharArray(); // Treat as ints for Unicode try { for (i = 0; i < txt.length(); i++) { outputFile.write( (int) ch[i]); // Write the data } outputFile.close(); // Close the file } catch (FileNotFoundException ex) // Things might go wrong { return 0; }catch (IOException e) { return 0; } return 1; } To read the data================================================================================ FileReader readFile; BufferedReader buffreader; Open the file: public int OpenTextFile(String fileName) { File inputFileName = new File(fileName); int readFlag = 0; try { // Try to get an input file stream readFile = new FileReader(inputFileName); buffreader = new BufferedReader(readFile); } catch (FileNotFoundException ex) { return 1; } return 0; } Read from the file: public String ReadOneLine() { String text; try { text = buffreader.readLine(); } catch (IOException ex) { return null; } return text; } Close the file: public void CloseRead() { try { buffreader.close(); } catch (IOException ex) { System.exit(0); } }