I\'m trying to insert and retrieve data from database in eclipse using sqlite, but it shows a RuntimeError. I create a layout with three edit texts and one button t
ctxx is never initialzed, and this probably the cause of the crash. Generally speaking, when you deal with Activity and Fragment subclass, you almost never need to keep a reference to the Context. Activity is a subclass of Context, and usually this is enough. In a Fragment you can retrieve the context of the Activity hosting the Fragment with getActivity()
Chante
DBHelper DB=new DBHelper(ctxx);
with
DBHelper DB=new DBHelper(MainActivity.this);
As @DerGolem pointed out, you are using the type INTEGER for the column MOTHER_NAME. Probably you want to use TEXT, instead, and you will also need a the primary key "_id"
db.execSQL("CREATE TABLE " + TABLE_NAME + " ("
+ BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ NAME + " TEXT,"
+ FATHER_NAME + " TEXT,"
+ MOTHER_NAME + " TEXT"
+ ");");