Click here to Skip to main content
15,898,374 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to generate a text file in android but when I see a file its giving me square symbols instead of using(\n \t)...

Can any one help me to generate formatted text file ??
my code is here to generate text file...
Java
File gpxfile = new File(root, sFileName);
       
FileWriter writer = new FileWriter(gpxfile);
        	        
writer.append(String.format(sBody));
writer.flush();
writer.close();
Posted
v2
Comments
AndroidVivek 22-Nov-12 6:29am    
sbody is String which made formatting as

===========
Header
===========

I am getting this in one line and when i am giving \n it shows in square bracket.

1 solution

We can use PrintStream instead of FileWriter , its working...
but still not working \n use println() instead of it...

PrintStream ps = new PrintStream(gpxfile);
ps.print("===============================================");
ps.println("\r");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900