The Android resource files can be roughly divided into two categories:
The first is a compiled resource file stored in the Res directory:
This resource file system will automatically generate the ID of the resource file in R.java, so it is simpler to access this resource file, through R.xxx.id;
The second is the native resource files stored in the assets direc
Usually we need to store on the phone for audio, video and so on large files, previously learned to use file for storage (using the file operation to store); Because of the small storage space of the phone itself, we need to store the file in SDcard, Today I also learned how to use the SDcard storage in Android;
First, if you want to use SDcard for storage in your program, we have to do the following permi
ObjectiveWelcome everyone I share and recommend useful code Snippets ~ ~StatementWelcome reprint, but please keep the original source of the article:CSDN:http://www.csdn.netrainy season o mo away:http://blog.csdn.net/luckkofBodySummarize:Asset Directory Files:Called native files, which are not compressed when packaged as an apk file and do not automatically generate an ID for r filesAccess:Get path: File://android_asset/test.xml
//The Assets folde
Read and write files in AndroidThere is only one disk in Android, a forward slash/root directory.The location of our Common SDK is:/mnt/sdcardTwo of the most common ways to store data:One, memorySecond, local1. Internal phone storage2. External storage device (SD card)It is not necessary to read data in SD card, but to
The previous section learned how to read and write files in the phone's internal storage, and this section learns how to read and write files in the phone's external storage. That's how to read and write files in SDcard.We also us
. In addition, the file class has some of the following common operations:String Name = File.getname (); Get the name of the file or folder:String Parentpath = File.getparent (); Get the parent directory of a file or folderString path = File.getabsoultepath ();//Absolute Road warpString path = File.getpath ();//Relative Road warpFile.createnewfile ();//Build fileFile.mkdir (); Create a folderFile.isdirectory (); Judging is a file or folderfile[] files
This article summarizes the methods of reading and writing the files in memory of the Android phone. Share to everyone for your reference. The specific analysis is as follows:
How to read and write the file data in the phone's memory?
The context provides a way to open the file I/O stream in the application's Data folder as follows:
FileInputStream open
1:android development, it is inseparable from the operation of the file, because the file can store a large amount of data, mastering the relevant technology can bring a lot of convenience for development, is our application in the mobile phone or simulator on the internal storage location.2: Through a simple program to achieve the Android application of internal files
1. Create the Assets folder and the Res/raw folder separately: (Note that the raw file is new under Res, and then create a folder with the name Raw)2. Create two txt files and copy them to the asset and raw folders:3. The effect of the implementation:4. Implementation code:(1) Layout file:1 XML version= "1.0" encoding= "Utf-8"?>2 LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 Xmlns
troublesome.But Google has provided us with a dedicated access to internal storage api:getfilesdir () Create a file where the user saves the user name and password //file file = new file ("Data/data/com.demo.storage/info.txt"); Getfilesdir returns a file object whose path is: data/data/com.demo.storage/files File File = new file (Getfilesdir (), "Info.txt") ;The path to the Getfiledir is under the
1) Edit a config.txt file and fill in the configuration system.2) There is an external loading file, Android publishing needs to specify a separate file publishing directory locationFor example, loading a config.txt requiresFirst, using Project->deployment, open the Publish File window and add the file you want to publish.Then set the location of the file release remote Path, filled in as assets\internal\3) uses System.ioutilsGet the file in your code
Android uses the path api to internally store read and write files. androidapiCopy and modify the original project
Copy the previously created Project CC + CV operation
To be modified:* Project name* Application package name* Re-import the R file package
Next, modify the package name in the file/AndroidManifest. xml: package = "com. wuyudong. rwinrom"
For simpli
1. Target: Save the byte stream image on the Android local path, such as "/data/mypppd/", File = File.documentsDirectory.resolvePath ("/data/mypppd/" +countpoint+ ". jpg"); New FileStream (); Filestream.open (file, filemode.write); Filestream.writebytes (Bytes[countpoint]); Filestream.close ();2. Target: Read the picture file display from the
Copy and retrieve thumbnails of multimedia files in the raw folder in Android
1. multimedia files in the raw folder
Get the input stream of the test file in this folder
InputStream is = getResources (). openRawResource (R. raw. test );
Obtain the file name.
String fileName = getResources (). getResourceName (R. raw. test); (package name + file name)
2. For the f
(intI, inti2) {}};Try{Roottools.Getshell(Root). Add (CC); }Catch(Exception e) {//Logger.errorst ("Exception when trying to run shell command", e); E.printstacktrace ();return null; }if(!Waitforcommand(cc)) {return null; }returnOutput; }4, the next is a simple call.FinalFile f=NewFile ("/data/misc/wifi/wpa_supplicant.conf");NewThread () {@Override Public voidRun() {Super. Run (); ArraylistNewArraylist; //String CPath = getcommandlinestring (F.g
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.