>
> import java.io.FileNotFoundException;
>
> import android.content.Context;
> import android.database.sqlite.SQLiteDatabase;
>
> public class DBHelper {
>         class Tuple extends Object {
>         public String name;
>         public String mobile;
>         public String address;
>         public String email;
>         public String notes;
>         public long rowId;
>         }
>         private SQLiteDatabase db;
>         public DBHelper(Context ctx) {
>
>         try {
>                 db =  ctx.openDatabase("AddressBook", null);
>         } catch (FileNotFoundException e) {
>         try {
>                 db =ctx.createDatabase("AddressBook", 1, 0,null);
>                 db.execSQL(DATABASE_CREATE);
>         } catch (FileNotFoundException e1) {
>         db = null;
>         }
>         }
>         }
>         private static final String DATABASE_CREATE =
>         "create table addressbook (_id integer primary key autoincrement, "
>         + "name text not null,"
>         + "mobile text not null,"
>         + "address text not null,"
>         + "email text not null,"
>         + "notes text null"
>         +");";
>         public void close() {
>         db.close();
>         }
>         }
>




> i got this tutorial somewhere from the net, but at the line:
>
> db =  ctx.openDatabase("AddressBook", null);
>
> i got an error: "the method openDatabase(String, null) is undefined
> for the type Context"
>
> Please help,
>
> Thanks,
>
GreenRiver

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to