简体   繁体   中英

Making a database with android?

I'm working on an android project that requires writing to a created database and later reading from it.

The idea is for the user to fill out a form and then submit, it will submit into a database table in the first row. Then if they hit submit again it will submit to the second row.

I have all of the activity layouts defined but I'm confused on how to make the databases. I'm thinking maybe I can make a content provider?

Can anyone advise me on what to do? All of the questions I look at on here skip the baby steps, and that's what I need

Yes you should make a content provider. There are a lot of great tutorials out there for making databases - try section 8.0 of this one

Since you plan to use a pre-loaded (created) database wherein the DB structure has been already defined, Refer to this link on how to include your pre-created DB file into your app :

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

And to then add new data to your database refer to this tut.. You can ignore the create Table part here since you already have the table structure ready.

http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/

Hope this helps.

Google对于Android开发的各个方面都有大量的手册, 网址为http://developer.android.com/training/basics/data-storage/databases.html

it might be done without content providers too.

this might be helpful.

http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/

First of all you dont need Content provider...Content provider is only need when you want to provide your data to other application...Its kind of central repository of data for other applications.

Now You have to use the SQLITE database in android...Since android support sqlite database.. Below link will guide you... http://developer.android.com/training/basics/data-storage/databases.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM