SHARE
TWEET

Untitled

a guest Oct 15th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         String path = Environment.getExternalStorageDirectory().toString();
  2.         File file = null;
  3.         String newline = "\n";
  4.  
  5.         file = new File(path + "/Peer 2 Peer/Saved txt files", FILE_NAME);
  6.  
  7.         FileOutputStream stream;
  8.         try {
  9.             stream = new FileOutputStream(file, false);
  10.             for (int i = 0; i < chatFullList.size(); i++) {
  11.                 // pw.write("It is here");
  12.                 String l = chatFullList.get(i).getIp().concat(" : ");
  13.                 stream.write(l.getBytes());
  14.                 stream.write(chatFullList.get(i).getMsg().getBytes());
  15.                 stream.write(newline.getBytes());
  16.                 Log.d(TAG, chatFullList.get(i).getIp() + " : " + chatFullList.get(i).getMsg() + "\n"); }
  17.                 stream.close();
  18.         } catch (FileNotFoundException e) {
  19.             e.printStackTrace();
  20.         } catch (IOException e) {
  21.             e.printStackTrace();
  22.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top