Android SQLite Database

Source: Internet
Author: User

Refer to Android Development Authority Guide

1 SQLite tool SQLite database browsersqlite expert extends sionalsqlite extends sqlitespy 2 sqliteopenhelperoncreate (sqlitedatabase dB) // check the database file name. this method is called if the database exists and does not exist. Generally, the onupgrade (sqlitedatabase dB, int olderversion, int newversion) data table is created. // compare the version number. If it is different, this method is called, generally, the old database is deleted. The new database 3 simplecursoradapter is bound to simplecursoradapter (context, int layout, cursor C, string [] From, int [] to) with the view control ); 4. Do not use openhelper for database operations. In this way, you can create database files in sdcard. One drawback is that there is no thread security guarantee and the database version management sqlitedatabase DB = sqlitedatabase. openorcreatedatabase ("/sdcrad/name. DB ", null1_mongodb.exe csql (" SQL "); cursor c = dB. rawquery ("SQL", new string [] {}); C. movetofirst (); // You must execute movetofirst, movetonext, or movetoposition, because the pointer publishes namedb with the APK five databases before 0th records. DB is placed in the raw directory inputstream is = getresources (). openrawresource (R. raw. namedb); fileoutputstream Fos = new fileoutputstream ("/sdcard/namedb. DB "); byte [] buffer = new byte [8192]; int COUNT = 0; while (COUNT = is. read (buffer)> = 0) {FOS. write (buffer, 0, count);} FOS. close (); is. close (); // The subsequent operations are the same as those of the 4th rows. The permission write_external_storage 6 memory database is basically the same as that of the 4th rows. The difference is that sqlitedatabase DB = sqlitedatabase. openorcreatedatabase (null, null );
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.