This article mainly describes how to write data to the SD card, where the main technology is environment in the method.1.2. Implementation code:/datasave/src/com/amos/datasave/savepasswordservice.java //Write data to SDcard Public
--java Creating a fileFile File=new file ("Java.txt");//At this time the Java workspace root directory does not necessarily exist java.txtDetermines whether a CreateNewFile method that does not exist that calls the file class is created Java.txtFile
1. click the button to copy the content in the assets folder to the SD card.
Private void copytosd (){
// Check whether environment. media_mounted is mounted on the SD card.
// Environment. getexternalstoragestate () returns the SD card status
If (!
Directory:
1. Move a file/rename
2. delete an object
3. List Files in the directory
1. Move a file/rename
Package mjn. io; import Java. io. file;/*** file operation: Move the file/rename * @ author mjn * @ date 2011-10-03 */public class filerename
Document directory
Main methods and constants in the file class
Procedure
Byte output stream: outputstream
Byte input stream: inputstream
Character output stream: writer
Character input stream: Reader
File class
In the entire Io package,
Java Attribute Class: common methods of Properties, javapropertiesThe Properties class itself is a subclass of the Hashtable class and stores data in the form of key-value. Set and obtain attributes:
Public class PropertiesDemo01 {public static void
Java reads and writes the properties configuration file, and the properties configuration file1.1. Read the properties configuration file 1.1.1. The file to be read
You can use the colon [:] and equal sign [=] between the key and value of the
1. Master the use of the Properties class
2. attributes can be stored and read in common and XML files.
Attribute is a common form in a program.
A special Properties class is provided in the class set to complete attribute operations.
Public class
Basic tutorial for Android -- 7.6.3 Socket communication based on TCP protocol (2)This section introduces:
In the previous section, we introduced some basic concepts and usage of Socket, and then wrote a simple chat room for piggyDemo, I believe
Java to read and delete files in folders
This article will share with you how to read and delete files in folders in java. File. delete () is used to delete "a File or an empty directory "! Therefore, to delete a directory and all its files and
Question 1: After removing a QR code image from your mobile phone or SD card, you can still see the preview thumbnail of the deleted image in the media repository.
Reference: Android: remove an image from sd card
Http://stackoverflow.com/questions/67
Creation of files and access to file information:First, create a Fileutildemo.java class to save the file name:Import Java.io.file;public class Fileutildemo {public static final String file_name= "Myfile.text";p ublic static final Str ing
I. Creation, deletion, and renaming of filesFile File = new ("/bin/hello.txt");//cannot be created, the system cannot find the path specifiedFile.createnewfile ();File File = new file ("Bin/hello.txt");File.createnewfile ();File File = new file ("..
There are several common methods to read and write files:1. Byte read/write (InputStream/OutputStream) and character read (FileReader/FileWriter)FileInputStream's read (buffer) method, each time from the source program file OpenFile. java reads 512
This article turns from: http://amcucn.iteye.com/blog/264457. Thanks to the authorRecently in the work, need to use to upload images of the function, but they usually learn only use struts upload function, but because the project did not use struts,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.