Friday, September 16, 2011

[android-developers] complieStatement(INSERT) crashing my app??

Im trying to use a datahelper class for my android database, and there
is one line that when executed causes my app to "quit unexpectedly".
Im using android 2.2 Library.

this.insertStmt = this.db.compileStatement(INSERT); // < Crashes the
emulator

When I comment the line out the app runs fine, but I cant use insert
because I cant get this line work. No errors are reported in eclipse
before I run the app in the emulator. Any ideas what this may be?

Thanks!

private SQLiteDatabase db;
private SQLiteStatement insertStmt;


private static final String INSERT = "insert into " + TABLE_NAME +
"(name) values (?)";

public DataBaseHelper(Context context) {
this.context = context;
OpenHelper openHelper = new OpenHelper(this.context);
this.db = openHelper.getWritableDatabase();
this.insertStmt = this.db.compileStatement(INSERT); // <
Crashes the emulator

.....
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment