Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String path = Environment.getExternalStorageDirectory().toString();
- File file = null;
- String newline = "\n";
- file = new File(path + "/Peer 2 Peer/Saved txt files", FILE_NAME);
- FileOutputStream stream;
- try {
- stream = new FileOutputStream(file, false);
- for (int i = 0; i < chatFullList.size(); i++) {
- // pw.write("It is here");
- String l = chatFullList.get(i).getIp().concat(" : ");
- stream.write(l.getBytes());
- stream.write(chatFullList.get(i).getMsg().getBytes());
- stream.write(newline.getBytes());
- Log.d(TAG, chatFullList.get(i).getIp() + " : " + chatFullList.get(i).getMsg() + "\n"); }
- stream.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement