4

Possible Duplicate:
sqlite example program in android

I need to open a database where I know the path/name, I need to read a known value, and write a value. I don't want to write 100 line "helper classes," I simply want to use the classes/functions that already exist. Can anybody provide a a simple example for this? It really shouldn't be more than a few lines of code.

1: Open database:

maybe this? openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)

2: Execute SQL to display value (in a Toast perhaps)

3: Close database

Once I understand this basic functionality I will then worry about helper classes etc. Thanks in advance.

EDIT:

Fascinating that every single answer so far links to articles that do EXACTLY what I asked not to do. I just want a simple 3 line example of how to directly open a database and read from it.

Community
  • 1
  • 1
Jimmy D
  • 5,183
  • 15
  • 49
  • 67
  • you can learn android sqlite database tutorial from here. http://techlovejump.com/android-sqlite-database-tutorial/ – rajat ghai Oct 26 '14 at 07:15

2 Answers2

9

A very good SQLite tutorial.

Vineet Shukla
  • 23,785
  • 9
  • 55
  • 64
3

Run through the notepad tutorial

f20k
  • 3,086
  • 3
  • 22
  • 32