Android data storage methods include:
1. sharedpreferences
2. File Storage
3. SQLite Storage
4. Content Provider)
5. Network
1. sharedpreferences
Android is used to store simple configuration information. Is a data type of the key-value relationship. The data is stored in
Android parses Json data of China weather network
In Android development, a general APP updates the UI by obtaining server-side data. The data obtained from the server can be Json, and the data size is smaller than that of XML, he
In Android, we can put some data directly in the form of a file to be present in the device. For example: Some text files, PDF files, audio and video files and pictures. Android provides a way to read and write files.The standard Java file input stream (FileInputStream) is obtained through the Context.openfileinput () method, and the standard Java file output str
() methods respectively. Both methods return a SQLiteDatabase object representing the database and provide the SQLite operation method. You can use SQLiteDatabase. the query () method is used to execute SQLite queries. This method receives various query parameters, such as the tables to be queried, query conditions, selected columns, groups, and mappings among others. For complex queries, such as columns with aliases, you should use the SQLiteQueryBuilder class, which provides several convenien
; string>
5. Supplement: setcontentview () in the activity class. In Android development, you can use setcontentview () to redirect to the desired layout file.
6. Supplement,
Horizontal line in the code During eclipse Encoding
When I used eclipse encoding today, I found that some variables or class names were inexplicably broken, as shown in:
Now I know what these dashes mean:The classes or methods marked by the dashes are in the old version and are
to JSON: String WKT. Read (string wktsr)
JSON to WKT method: String WKT. Write (string jsonstr)
2)Based on the first point, you can set WKTGenerate ArcGIS for AndroidRy.
Read the WKT string of the Ry from the spatialite database:
Select astext (geometry) from test
Convert the WKT string to JSON and convert the JSON string to a ry object through the jsontogeometry method of geometryengine.
String STR = "{\" rings \ ": [[1007664.4779535953, 3710553.4649297176], [957962.4793888753, 3190110.9788053
getreadabledatabase () methods respectively. Both methods return a sqlitedatabase object representing the database and provide the SQLite operation method.
You can use sqlitedatabase. the query () method is used to execute SQLite queries. This method receives various query parameters, such as the tables to be queried, query conditions, selected columns, groups, and mappings among others. For complex queries, such as columns with aliases, you should use the sqlitequerybuilder class, which provid
two parameters without doing an operation, directly returning Hello Jni, without the tube String str = jniclient.addstr ("Test", "Test"); The second method is temporarily not implemented // int isum = Jniclient.addint (5, 2); String Strsum = "5 + 7 =" + Isum; TextView TV1 = new TextView (this); Tv1.settext (str); Setcontentview (TV1); }}6. Run the TESTNDK project and you can see the interface output from the "HelloWorld
Use the following code in Android to sharedpreferences data sharing between two applications, but only if you want to ensure that the android:shareduserid of the two applications is the sameContext context = NULL; try {context=createpackagecontext ("com.android.providers.downloads", context.context_ignore_security);} catch ( Namenotfoundexception e) {//TODO auto-
Android data loading and Json parsing-Original Version
1. Create an object class for data download
class MyData { String imagepath; String title; String desc; public MyData(String imagepath, String title, String desc) { super(); this.imagepath = imagepath; this.title = title; this.
In Android development, the general app is to get server-side data to update the UI, from the server to obtain the data can be JSON, its data is smaller than XML, the analysis of the Chinese weather online access to the data, although it is no longer updated, but to learn is
();}}I feel that this is a fixed class that can be used only with JSON. Did not try, do not know right ah.Package Com.example.mychat;import Java.util.arraylist;import Java.util.hashmap;import java.util.List;import Java.util.map;import Org.json.jsonarray;import Org.json.jsonobject;import Android.app.activity;import Android.os.bundle;import Android.view.view;import Android.view.view.onclicklistener;import Android.widget.Button; Import Android.widget.listview;import Android.widget.simpleadapter;im
formatAndroid:inputtype= "Textvisiblepassword"--Password visible formatAndroid:inputtype= "Textwebedittext"-text format as a Web FormAndroid:inputtype= "TextFilter"--Text filter formatAndroid:inputtype= "textphonetic"--Pinyin input formatAndroid:inputtype= "number"-Digital formatAndroid:inputtype= "numbersigned"--Signed number formatAndroid:inputtype= "Numberdecimal"--floating point format with decimal pointAndroid:inputtype= "Phone"--dial keypadAndroid:inputtype= "datetime"Android:inputtype= "
is a View object
Baseadapter
Two methods that must be implemented
First one//系统调用此方法,用来获知模型层有多少条数据@Overridepublic int getCount() { return people.size();}
A second//系统调用此方法,获取要显示至ListView的View对象//position:是return的View对象所对应的数据在集合中的位置@Overridepublic View getView(int position, View convertView, ViewGroup parent) { System.out.println("getView方法调用" + position); TextView tv = new TextView(MainActivity.this); //拿到集合中的元素 Person p = people.get(position);
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.