Thanks for all replies! Before reading the commands i went for a walk
for 5 minutes. When i turned back tried this code snippet,it worked. I
wanted to share for who will have the same problem with me.
But i realized createNewFile() function is useless. It creates the
file even if i use or not. Is there a key point of this function?
File path = Environment.getExternalStorageDirectory();
File myFile = new File (path,"file1.txt");
FileWriter writer;
try {
writer = new FileWriter(textFile);
BufferedWriter out = new BufferedWriter(writer);
out.write("hey");
out.close(); }
or
File myFile = new File("/sdcard/file1.txt");
myFile.createNewFile();
try {
FileOutputStream fos = new FileOutputStream(myFile);
OutputStreamWriter out = new OutputStreamWriter(fos);
out.close();
fos.close();}
But i realized createNewFile() function is useless. It creates the
file even if i use or not. Is there a key point of this function?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en