First of all, what is internal storage ?Under the Android platform, it has its own independent data storage rules, under the Windows platform, the application can access or modify the file resources under other applications freely or on the basis of specific access rights.But under the Android platform, all the data of an application is private, and only the appl
abstract In fact, the operation of the Android file and Java in the PC environment is not two, the reason why need to be explained separately is because the Android system provides different from the PC to access the file system root path of the API, while the application of a private file to do a unified management. In my experience, beginners in this section feel it is easy to confuse both internal storage
Original link: http://m.blog.csdn.net/article/details?id=17725989abstract In fact, the operation of the Android file and Java in the PC environment is not two, the reason why need to be explained separately is because the Android system provides different from the PC to access the file system root path of the API, while the application of a private file to do a unified management. In my experience, beginners in this section feel it is easy to confuse both in
As we all know, in the actual work of development, enter the need to write a file to the phone's storage. Since we're talking about cell phone storage space, let's talk about cell phone storage space classification:1: Internal storage spaceRAM memory: The memory of the phone
Android stores and loads local files (internal storage devices) and android storage devices
All applications on Android devices have a directory of files placed in the sandbox. Saving the files in the sandbox can prevent other applications from accessing them.
The full path of the sandbox directory is/data/
As you can see, each application has a file directory n
Download source code (download-free credits): Download
You can directly store data in internal storage. By default, files are private to internal storage and cannot beWhen you uninstall an application, the files are removed.You can create and write data in two ways:
Using related methods in java,
Use the related met
File storage (internal storage)once the program is installed in the device, the data/data/package name/That is the internal storage space, external confidentiality.The context provides 2 ways to open an input, output stream
FileInputStream openfileinput (String name)
Learn android from scratch (Data Storage (2) Internal Storage. 36 .)
CallopenFileOutput()With the name of the file and the operating mode. This returnsFileOutputStream. PassOpenFileOutput () creates a FileoutputStream object
Write to the filewrite(). Create a Write object and perform data read/Write operations.
Close the streamclose(). Close the link.The abov
source Download (download points free): DownloadYou can store the data directly into the internal storage, and by default, the file is stored in the internal storage that is private and cannot beOther programs are accessed, and when the application is uninstalled, the files are removed.There are two ways to create and
Some of the application's configuration files need to be stored on the phone. Generally divided into internal storage and SD card storage.One. Internal storage, to FileOutputStreamNew File (Getfilesdir (), "User.txt"); // Open local File preparation record Try { new fi
ObjectiveI've been talking about Androidui, but it's not over yet, and I'll add it later. Today, I'll talk about other things about data persistence. For an application, it is unavoidable to be able to store the data, and the Android program is no exception. In Android, there are several ways to implement data persistence. The following will be described separately.In Android, data persistence can be achieved in several ways:
Shared Preferences: A sharing Parameter form, a way to save d
Android learning notes: internal storage of data; practice Data Reading and writing; storage to Cache for reading and writing; android learning notes
(1) directory structure
(2) Layout file:
(3) tool class for saving and reading data: FileService. java
Package com. example. data_storage_interal.file; import java. io. byteArrayOutputStream; import java. io.
Android newest mobile phone internal storage size, SD card storage size Method
We used to obtain this information in the past.
// Before Android API18: fs. getAvailableBlocks () * fs. getBlockSize ()
Currently:
/** Obtain available system memory **/@ SuppressLint ("NewApi") private String getMemFree () {StatFs fs = new StatFs (Environment. getDataDi
> Read Side write:Byte[] Buffer=new byte[1024];int len=-1;while ((Len=is.read (buffer))!=-1) {Fos.write (Buffer,0,len);}Fos.close ();Is.close ();To read a picture:1> Get picture path:/data/data/packagename/filesString Filespath=getfiledir (). GetAbsolutePath ();String imgpath=filespath+ "/logo.png";2> loading picture file to get Bitmap object:Bitmap Bitmap=bitmapfactory.decodefile (Imgpath);3> set it to ImageView display:Iv_if.setimagebitmap (bitmap);Third, the source codeSave Picture:Assetmanag
We usually develop when the file cache, commonly used in the mobile phone internal storage and external storage of mobile phones, mobile phone internal storage mainly includes the app after the installation of some files, external storag
One. Create1./src/main/assets2. Switch to Project view mode and create a new folder under Main assetsTwo. Features1. Same level as Res2. Mainly to store large files in the project3. File is not managed by R classThree. API1.AssetManager Asset Manager1-getassets () Get asset manager2-open (file name) returns the InputStream of the file2.imageview:setimagebitmap (Bitmap instance) to set a bitmap for a picture view3.Bitmap bitmap: bitmapfactory.decodefile (picture file path) Use factory method to g
Android briefly introduces SharedPreference, internal files, and sdcard data storage,
SharedPreference
Store simple data in xml structure and store it in the data/package name/shared_prefs folder
Usage
There are three ways to create an object
GetSharedPreferences () of Context ()
GetPreferences () of the Activity ()
Getdefasharsharedpreferences () of PreferenceManager ()
Get Data
SharedPrefs. getXXX () meth
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.