2

I'm working on Android App that will user's input data (from text box) store in database and later will show that data and work with it. But I can't find any quality tutorial for this. Can anyone help me get started with databases in Android or just recommend good and extensive tutorial?

Croatia Boy
  • 305
  • 1
  • 4
  • 14

3 Answers3

1

here's google's introduction,

http://developer.android.com/guide/topics/data/data-storage.html#db

that section has links to two sample apps: Notepad and Searchable dictionary.

Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134
0

Here's a pretty good tutorial series:

http://mobile.tutsplus.com/tutorials/android/android-sdk_content-providers/

Note that a database may be overkill for what you're looking for, you may just want to use Shared Preferences: http://developer.android.com/guide/topics/data/data-storage.html#pref

Sam Dozor
  • 40,335
  • 6
  • 42
  • 42
0

You can use simple approach and test my sample SQLite database project.


If you want to insert value data from textbox then:

 final EditText et = (EditText) findViewById(R.id.et);
 String ee = et.getText().toString();
 db.execSQL("INSERT INTO LIST VALUES('"+ee+"');");  

Where db is an object of SQLiteDatabase type and et is your textbox where user gives input.

Imran Rana
  • 11,899
  • 7
  • 45
  • 51
  • @Croatia Boy let me know if it helped you. – Imran Rana May 22 '12 at 20:21
  • your project helped me, you wrote it simple and clear. Can you tell me on which way can sqlitejdbc.jar help me? – Croatia Boy May 23 '12 at 22:59
  • When I have already completed database on my HDD and I want use it in my app, is SQLite JDBC good solution for that? And when I install app on my phone DB should be copied there so my app can use it. – Croatia Boy May 23 '12 at 23:31
  • If you want to use your manually created database(which will be in **sdcard**) just access it like `File dbfile = new File("/sdcard/Your_db_File.db" ); SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(dbfile, null); ` and use the **db** object as shown in my sample, you can also ship your database with your app by keeping it in **assets** folder and access it via code, [example here](http://davehiren.blogspot.com/2011/12/use-existing-sqlite-database-in-android.html) – Imran Rana May 23 '12 at 23:47
  • And about **sqlite JDBC** : see [problem with JDBC](http://stackoverflow.com/questions/1728476/does-android-support-jdbc). If you still need it try [SQLDroid](https://github.com/SQLDroid/SQLDroid/wiki/Quick-Start) – Imran Rana May 24 '12 at 00:06