Types of memory in Android systems and how to store and data localization
5 minute(s) read | Published on: Aug 12, 2021 Updated on: Dec 14, 2021 |
There are different memories for storing data and information in Android systems that can be used in various types of data storage. In this case, preference is one of those memories for data storage. In addition to appreciation, other memories can be used in Android systems, which include internal memory, external memory, QLite memory, and data storage through networks and connections.
In this part of the tutorial, we will examine the internal memory of Android systems. If you want to know about it, it is recommended that you follow this article.
internal memory
It should be noted that internal memory is the memory used to store a variety of personal data of users inside the system. This type of data is considered confidential data by default. This data can be deleted when the user deletes the application because access to this type of data is possible through these applications.
To write and store some data in the internal memory, we can call the openFileOutput () method and perform the desired operation. Like the following:
An example of FileOutputStream is reported by the openFileOutput () method, which is why we receive it inside the FileInputStream object. Like the following:
Then, you can call the openFileInput () method to read the file inside the internal Storage. Note that this method can also return an instance of FileInputStream. Like the following:
There are other methods that can be used in addition to this method for writing that can be provided within the FileOutputStream group.
- FileOutputStream method (File, boolean append):
This method can create a new FileOutputStream and write it to the file.
- GetChannel () method:
This method can also be used to report write-only FileChannel, which shares its position.
- getFD () method:
There are other methods that can be used in addition to reading that can be provided within the FileInputStream group.
Available method ():
This method can provide an approximate number of bytes.
- GetChannel () method:
This method can report a read-only FileChannel that shares its location.
- getFD () method:
This method can also be used to report the original descriptor file.
- Read method (byte [] buffer, int byteOffset, int byteCount):
This method can also read longer bytes.
In this part of the article, we want to consider an example for you that creates a program that can write data to internal memory and read data from it.
1- I use Eclipse IDE to create an Android application.
2- Name it Storage in the package com.example. Storage.
3- Modify the src / MainActivity.java file to add a different code.
4- The res/layout / activity_main file must be modified to add the XML component.
5- Change AndroidManifest.xml to get permissions.
6- All contents and codes that are completely included in the file and program are as follows:
7- Contents in res / layout / activity_main.xml:
8- The contents of the res/values / string.xml file:
9- Contents in the AndroidManifest.xml file:
10- Run the IntentShare program.
11- You must connect your mobile device to the computer beforehand.
12- To run the program from Eclipse, we must open one of the program activity files and click Run on it.
13- Then, enter a text in the relevant text field, then select the save button.
14- We will see that a message will appear in AVD.
15- To read the file and memory, we must press the load button.
Android localization in memory
In this part of the article, we also want to tell you how to save installed applications to be localized.
Localizing Strings
To localize applications, we need to create a new folder inside the res folder called values local.
You can follow the codes below:
Codes and languages related to an area are listed below:
1- Afrikanns Code: af. Folder name: values-af
2- Arabic code: ar. Folder name: values-ar
3- Bengali Code: bn. Folder name: values-bn
4- Czech Code: cs. Folder name: values-cs
5- Chinese Code: zh. Folder name: values-zh
6- German Code: de. Folder name: values-de
7- French Code: fr. Folder name: values-fr
An example of creating a program to localize data and applications in the internal memory of the Android system 1- We use Eclipse IDE to produce an Android application.
2- Name its locals in the package com.example.locals.
3- Modify the src / MainActivity.java file to add a different code.
4- The res/layout / activity_main file must be modified to add the XML component.
5- Change AndroidManifest.xml to get permissions.
6- All contents and codes that are entirely included in the file and program are as follows:
7- The contents of the activity_main.xml file:
8- The contents of the string.xml file:
9- The contents of the string.xml file:
10- Contents of AndroidManifest.xml file:
11- Run the IntentShare program.
12- You must connect your mobile device to the computer beforehand.
13- To run the program from Eclipse, we must open one of the program activity files and run it.
14- This article will change the language to Italian Raban through the menu / system-settings / language window.
Because the settings we have made in this program are for Italian code and language.
About our Android and iOS app development services