Android SQLite database BASICS (1 continued), androidsqlite

Source: Internet
Author: User

Android SQLite database BASICS (1 continued), androidsqlite

Supplementary note, in the previous article, I have joined the following content, have not read the first article, you can directly read the first article can be (http://www.cnblogs.com/flylin/p/qq_980542577.html ). Read this article.

 

Create a test class to test whether the Code mentioned in the previous article is correct:

Add the following code to the manifest node of AndroidManifest. xml in the project:

<Instrumentation
Android: name = "android. test. InstrumentationTestRunner"
Android: targetPackage = "package name"/>

Add the following code to the application node of the manifest node:

<Uses-library android: name = "android. test. runner"/>

 

The result is as follows:

 

In the test class, the code I wrote is as follows:

Package com. example. sqllites. dbs. test;
Import com. example. sqllites. dbs. sqlite_Persondb;
Import android. test. AndroidTestCase;

/**
* Test class
* White box testing
* @ Author Lin
*
*/
Public class sqliteTest extends AndroidTestCase {
Public void testSQLite () throws Exception {
/**
* If only objects are declared, the database is not created, similar to File.
*/
Sqlite_Persondb sqlite_per = new sqlite_Persondb (getContext ());
/**
* Use the following code to create a function
*/
Sqlite_per.getWritableDatabase ();
}
}

 

The running result will get two database files, which are opened by sqlite3, for example:

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.