views:

190

answers:

5

Does anyone know a good step by step tutorial for using sqlite on Android?

I've found this: http://developer.android.com/guide/topics/data/data-storage.html#db and it ok to start with, but then it wants me to jump into other source code then its difficult to follow.

I've tried others on the web, one from screaming penguin and that just kept causing errors with JVM.

Advice greatly appreciated.

I need to:

  • Create database, with several tables (auto id, declare type)
  • update
  • get
A: 

As a start i use this one:

http://www.anddev.org/working_with_the_sqlite-database_-_cursors-t319.html

It also creates a database with one table (i think it should be easy to adapt to serveral table) and it uses als gets. Update is mentioned in this tutorial.

Then I also used this one:

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

But unfortunately this code isn't for 2.1 (ok i just noticed that you don't mentioned for which version you want to develop)

If you understand German, this tutorial is also very useful:

http://android-developers.de/tutorials-faqs/der-umgang-sqlite-404.html

And here (somewhere in the middle) it is explained how to update database:

http://www.higherpass.com/Android/Tutorials/Accessing-Data-With-Android-Cursors/

Roflcoptr
Thanks, Sebi. I'm using 1.5
Paul
http://www.anddev.org/working_with_the_sqlite-database_-_cursors-t319.html - Is this compatible for 1.5. he says: SDK version m3-xxx or older
Paul
Im not sure. But the tutorial is very old, so maybe it's for 1.5.
Roflcoptr
Thank you, Sebi
Paul
+1  A: 

You probably should start playing with SQLite on desktop. This is nice Administration Tool for SQLite wrote in Air: http://www.dehats.com/drupal/?q=node/58.

Also motodev studio android has some tools for playing with SQLite

Maciek Sawicki
+2  A: 

There is a much easier to follow version of the code you say is difficult to follow. It is bascially a tutorial, with a step by step guide: http://developer.android.com/intl/zh-CN/resources/tutorials/notepad/index.html It is quite nice!

janfsd
A: 

you just need to know how to use sqlite wrapped by java, then you could know how use sqlite for android. since sqlite is implemented by c/c++, just wrapped by java, their flow are same.

you can reference here: http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers http://www.zentus.com/sqlitejdbc/

bygreencn
+1  A: 

Hi Paul,

As Maciek suggests, MOTODEV Studio does have a GUI front-end for SQLite. The product is generic for all Android devices, so it's not just for Motorola phones. The only restriction is it has to be used with the emulator or a developer phone because a locked phone requires access to /data. We're working on a major update in a few weeks that will allow you to open databases stored on the SD card, so that's a workaround for using the tool on a production phone.

http://developer.motorola.com

-E

Eric Cloninger