Android learning 10 (android file storage)
The android system provides three methods for simple data persistence, namely file storage, SharePreference storage, and database storage. You can also save the data to the SD card.
File
Chapter 2 androidmanifest. xml file
Each Android Application must have an androidmanifest. xml file under the root directory (the file name must be this ). This manifest file lists the required information of the application to the Andro
(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
Local_path: =$ (call my-DIR)
1 local_path must be located at the beginning of the android. mk file. It is used to locate the source file,$ (Call my-DIR) is used to return the path of the current directory.
Include $ (clear_vars) is used to clear the values of some variables, except for local_path.
Local_module is used to specify the name of the modul
/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
Video file upload protocol analysis in Android
L run the web application on the server,
L upload a video file, capture data packets with httpwatch, and explain the following:
POST/videoweb/video/manage. do HTTP/1.1Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd. ms-excel, application/vnd. ms-powe
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-simple sdcard file browsing, android-sdcard
Function: allows you to browse the folders and files on your mobile phone. The code is usually too simple.
First view Layout
Main Function
1 package com. example. fanlei. myservicedemo; 2 3 import android. annotation. targetApi; 4 import
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
The android. mk file is a required file for compiling C code using ndk. The Android. mk file describes which c files will be compiled and how to compile them. To understand how to compile Android. mk files, you can master the keyw
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
Previously, I briefly introduced two data storage methods, for example, shared preferences, in [Android evolution 14th], I wrote an example of the address book for storing data in the SQLite database. Next I will introduce the format of storing data in file. I will talk about two points in file format, files cannot be shared among different programs. Another feat
The batch file upload function is often used in the project. This problem is solved today and can be written here for future reference. First, batch file upload in the following architecture may fail or fail: 1. android client + springMVC server: the server uses org. springframework. web. multipart. multipartHttpServletRequest is used as the batch upload receivin
. Some of your own words:This is my first blog, a long time ago to write, but a little afraid, this thing takes time and energy. And then their own this side of the way, the basic is self-study, a lot of things just start completely do not understand, some mistakes, online can not find a solution, ask questions, not get timely reply, also not necessarily to be resolved.Sometimes really forced into the desperate situation, I am very hard, a lot of things have been deleted, a step by step start, t
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.