+ 1

How can i create files in Java on android?

23rd Dec 2018, 1:22 PM
kritomas
7 Answers
+ 2
PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8"); writer.println("The first line"); writer.println("The second line"); writer.close();
23rd Dec 2018, 1:25 PM
Lighton
Lighton - avatar
+ 1
Vops, I forgot to specify, that it has to be on Android. My bad!
23rd Dec 2018, 1:26 PM
kritomas
+ 1
I suppose the same way
23rd Dec 2018, 1:27 PM
Lighton
Lighton - avatar
+ 1
Tomas Krizko wait do u mean on your phone using solo learn or android based IDE?
23rd Dec 2018, 1:45 PM
Asirap
+ 1
Tomas Krizko i see! you'd have to check out their help section to see if they allow creating files.
23rd Dec 2018, 2:08 PM
Asirap
0
import java.io File f = new File("filename.txt"); /*you can create a text file manually in the project folder or create a new one using: */ f.createNewFile(); There are a lot more specifics like if you want to specify file location you'll easily find these with a google search.
23rd Dec 2018, 1:40 PM
Asirap
0
I use JAVA-N-IDE (Java IDE for Android)
23rd Dec 2018, 1:57 PM
kritomas