java - System.getProperty("line.separator") not working - Android Studio -


currently have code retrieve website plain text , store inside text file. managed when want enter new line in text file doesn't work.

my result

this article titlethis starting of first paragraph 

what want

this article title starting of first paragraph 

my source code

public void storehtml(context context, arraylist<string> storehtml, string address) {     try {         file root = new file(environment.getexternalstoragedirectory().getabsolutepath()+ "/voicethenews");         if (!root.exists()) {             root.mkdirs();         }          address = address.substring(address.lastindexof("/") + 1);          file gpxfile = new file(root, address + ".txt");         filewriter writer = new filewriter(gpxfile);          //fileoutputstream fileoutputstream = new fileoutputstream(gpxfile);         //bufferedwriter bufferedwriter = new bufferedwriter(new outputstreamwriter(fileoutputstream));          for(int = 0; < storehtml.size(); i++) {              //bufferedwriter.write(storehtml.get(i));             //bufferedwriter.newline();             writer.append(storehtml.get(i) + system.lineseparator());           }          writer.flush();         writer.close();         toast.maketext(context, "saved", toast.length_short).show();     } catch (ioexception e) {         e.printstacktrace();     } } 

i've tried multiple code , solution it's still not working.

i found actual reason why doesn't display intended.

the reason why doesn't seem work in first place due me opening text file using default notepad. when open using other text editor such notepad++, output in text file writen intended.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -