In Android, these files are stored in/Data/Package_name/FilesDirectory.
Data Reading
Public static string read (context, string file) {string data = ""; try {fileinputstream stream = context. openfileinput (File); stringbuffer sb = new stringbuffer (); int C; while (C = stream. read ())! =-1) {sb. append (char) C);} stream. close (); Data = sb. tostring ();}
(1) The android.mk file first needs to specify the Local_path variable to find the source file. As a general caseAndroid.mk and the source files that need to be compiled are in the same directory, so they are defined as follows:local_path:=$ (call My-dir)The above statement means that the LOCAL_PATH variable is defined as the directory path of the cost file.
(2)
This example for you to share the Android through the HTTP protocol to upload the file data of the specific code for your reference, the specific contents are as follows
Sockethttprequester.java
Package cn.itcast.utils;
Import Java.io.BufferedReader;
Import Java.io.ByteArrayOutputStream;
Import Java.io.DataOutputStream;
Import Java.io.InputStream;
Import Java.io.InputStreamReader;
Import Java.io.Out
/blog_933d50ba0100wq1h.html
Second, read and write files in Android
(1) Get the file from the Raw folder in resource and read the data (resource file can only read and write, \res\raw\test.txt)
Copy Code code as follows:
String res = "";
try{
InputStream in = Getresources (). Openrawresource (R.raw.test);
int length = in.available ();
byte
When Android is developed, you will encounter the following scenarios
I want the application to download to the root of the current application, not the SD card
This file can then be accessed by the application or other application at any time, with permissions that are read globally
File writes can be made using the context's local
, so is the Volume amplification key +9.
Auto-fill path: For example, the path is/usr/bin/autostart.sh
Then the input/usr/bin/aut press TAB to be able to complement all/usr/bin/autostart.sh
This will make it impossible to enter the garbled characters automatically fill up .
Step Poly:
1, open the terminal with ls command to see the file name to be deleted
Ls-a file path
-A indicates that hidden fil
completes.
Client, use Java socket communication to issue a connection request to one of the servers on the network, open the session once the connection is successful, and close the socket after the session completes. The client does not need to specify an open port, typically temporarily, dynamically allocating more than 1024 ports.
TCP Network Connectivity Model:
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/
Android file operation-read assets and RAW file content
1. Create Assets folders and Res/raw folders individually: (Note that raw files are new in res and then create a folder with the name Raw)
2. Create two txt files and copy to asset and raw folders:
3. Effect of implementation:
4. Implementation code:
(1) Layout
A file manager is a software that manages files, helps users with their day-to-day work, and manages files stored locally and on the network. All file managers provide basic operations such as creating, opening, viewing, editing, moving, and deleting files. Many Android file managers also provide additional functionali
android-appears read-only file system solution
Enter command:
The code is as follows
Copy Code
Mount-o remount Rw/system
(Execute once each time)
Some friends say is "/" the question, the order should read: ADB push alarmclock.apk Systemapp namely "/" Change "" can. ADB push computer Path simulator path must be "" in the computer path and the emulator must be "/" and
Android provides a tool class: Asynctask, which makes it easier to create long-running tasks that require interaction with the user interface. Compared with handler, Asynctask is lighter, suitable for simple asynchronous processing, without the use of threads and Handter. Asynctask is an abstract class. Asynctask defines three generic types params,progress and result:
Params the input parameters that start the task execution, such as the URL of the H
How to create a third-party database for Android software development and how to read a database from a file
Original by Yu Song MomoArticleIf you reprint it, please note: Reprinted to my independent domain name blogYusong Momo program Research Institute, Original address: http://www.xuanyusong.com/archives/199
I haven't updated my blog on the android
Android File Management MethodAndroid uses a Linux-based file system and restricts file access and management through permission settings.In Linux, file permissions describe the operation restrictions on files by creators, users in the same group, and other users.X indicates
--------------------------------------------------------------------------------------
Android: Theme
If no theme is set, the theme style of the activity belongs to the application. For more information, see the theme attribute of the Bytes --------------------------------------------------------------------------------------
Android: windowsoftinputmode
The interaction mode between the main activity windo
How to slim down your Android Installation File (APK) and androidapk
Source Address: How to slim down your Android Installation File (APK)
It is an indisputable fact that the apk file of Android is getting bigger and bigger. In
Use the buttons in the upper-right corner to export and import files from the simulator.
Program running result
After running, delete in the file browser is deleted.
FileHelper. java is a help class for files. It creates, deletes, and reads files.
Package com. zeph. android. fileoperate;
Import java. io. File;
Import java. io. FileInputStream;
Import java
Android configuration file (3) ---- root node of the application
1.
Generally, when an Android application is generated, the default AndroidManifest. xml file contains some default
Android: backupAgent = "string"
Android:
A file encoding test is conducted to prepare for the next file. Four files with different codes must be prepared.
The file name is specified in the code.
The xml Code is as follows:Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: orienta
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.