"Android" gadget to create a database

Source: Internet
Author: User

Function

Easy to import the text table data into the database, so as not to manually add a strip of simulation data.

How to use

Place the text table in the appropriate location, similar to the following:

File location:/assets/mock_table.csv: File contents: name#string, Age#int, course#stringxesam_1, 1, desc_axesam_2, 2, Desc_bxesam_3, 3, Desc_cxesam_4, 4, Desc_dxesam_5, 5, Desc_exesam_6, 6, desc_fxesam_7, 7, Desc_g

Then call the following method in application or activity or other appropriate places:

Mocksqliteinflater sqliteinflater = new Mocksqliteinflater ();             Sqlitedatabase DB2 = Sqliteinflater. AddTable (mocktable.newassettable ("Mock_table.csv", Aliastablename)) . Reinflateto (this, dbName);

The above call creates a database named DBName, and then imports the contents of the Mock_table.csv file into the aliastablename database table

Demo

Other methods have been demo see Https://github.com/xesam/MockSQLiteInflater

Android Share Q Group: 315658668


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.