Alibabacloud.com offers a wide variety of articles about android database app creator, easily find your android database app creator information here online.
I will create another project on Android in the last few days. I need to read the SQLite database file into the program, and the result is more than N days... I am not strong enough... Later, I found an example on the Internet to read the. DB file into the SD card and then read it from the SD card.
Package COM. easymorse; import Java. io. file; import Java. io. fileoutputstream; import Java. io. inputstrea
){Db.exe cSQL ("drop table if not exits person (_ id integer primary key autoincrement, name varchar (40), age integer )");}@ OverridePublic void onUpgrade (SQLiteDatabase db, int oldVersion, int newVersion ){// TODO Auto-generated method stub}
}
2. Write a test class to see if the database has been implemented.
The code for the MyDBOpenHelperTest class is as follows:
Package cn. sg. mydb. test;Import cn. sg. mydb. MyDBOpenHelper;Import
the data is first created // sqlitedatabase is encapsulated with db.exe csql ("create table person (personid integer primary key autoincrement, name varchar (20 )) ") ;}@ overridepublic void onupgrade (sqlitedatabase dB, int oldversion, int newversion) {// call when the version number changes // execute the update operation // use a field db.exe csql ("alter table person add phone varchar (12) null ");}}
Write a test class to create a database.
);
4. Simple demo program
To connect to the Internet, you must add the permission to connect to the network in androidmanifest. xml:
The complete androidmanifest. XML is as follows:
Connect to Microsoft SQL Server, and then output the result in the background system. Out. println:
Result chart:
/* Author: conowen * Date: 2012.4.7 * android_connect_sqlserveractivity */package COM. conowen. sqlserver; import Java. SQL. connection; import Java. SQL. drivermanager; import Java. SQL. resu
Android-display database data to the screen
MainActivity. java
This code retrieves data from the database and displays the data on the interface.
Import java. util. arrayList; import java. util. list; import com. itheima. showdata. domain. person; import android. OS. bundle; import
SQLite database with its light weight, small size and so on, so that its application in the development of a very wide, in the previous blog I also introduced in Cocos2d-x in the use of SQLite database, this blog is to introduce the use of the SQLite database in Android, The SQLite
If you don't talk much about it, directly add the code, and the comments in the Code are clear.
Package mars.com; import android. app. activity; import android. content. contentvalues; import android. database. cursor; import android
AndroidTestCase {Public void testOncreateDatabase (){New MyDBOpenHelper (this. getContext ());}}
3. Configure some configuration files, androidmanifest. xml
The androidmanifest. xml Code is as follows:
Package = "cn. sg. mydb"Android: versionCode = "1"Android: versionName = "1.0" type = "codeph" text = "/codeph">Android: label = "Test for my
implemented in this way.Previous versions need to refer to namespaces:Using Mono.Data.Sqlite;The new version (1.0.99) supports various versions of. NET, including. NET 4.5, 4.6, and LINQ, Entity framework, and so on, but is not yet mature, still in continuous improvement, temporarily do not use it, and so it perfect again play is not too late.The new version needs to refer to the namespace:Using SYSTEM.DATA.SQL;Using System.Data.SqlClient;(3) Implement with Sqlite-netSqlite-net is a lightweight
requires the use of a shell. This time we will use the shell to access the SQLite database files in the Android app.1, run the cmd, switch to the ANDROID-SDK directory, run Adb.exe, plus the parameter shell, the presence of the # sign into the shell command mode, note that ADB to run the
SQLite is a small relational database built into Android. Sqliteopenhelper is an abstract class that is used to assist in managing database creation and version escalation issues. We can inherit this abstract class and implement some of its methods to customize the operation of the database. The following two methods m
There are 5 commonly used databases in Android development:1. OrmliteOrmlite is not a dedicated ORM framework for the Android platform, it is a Java ORM. Supports JDBC connection, spring and Android platform. Annotations (Annotation) are widely used in the syntax. 2. SugarormSugarorm is a dedicated ORM for the Android
Saveasync () instead of Save (). It will save the album asynchronously to the database, and the saved result will be recalled to the OnFinish () method.8. Multiple databasesIf your app requires multiple databases, Litepal fully supports it. You can create any number of databases at run time. For example:New Litepaldb ("Demo2", 1); Litepaldb.addclassname (Singer. class . GetName ()); Litepaldb.addclassname
create a database, which is used for database upgrades, and to create classes dbservices as follows: Public class dbservices extends sqliteopenhelper{ Final Static intVersion =1;Final StaticString DbName ="Plan"; Public dbservices(Context context) {Super(Context,dbname,NULL, version); }@Override Public void onCreate(Sqlitedatabase db) {//TODO auto-generated method stub //Create today Schedul
The Android system comes with a database called SQLite. In this article we use a demo to illustrate an example of an Android operating database.by theThe database files created by Android are stored under the/data/data/See the database
As an Android app, you will inevitably deal with SQLite. With the continuous upgrading of the application, the original database structure may no longer adapt to the new features, this time, you need to upgrade the structure of the SQLite database. SQLite provides the ALTER TABLE command, which allows the user to renam
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.