1

This is fragment from db class existing on my onCreate method. Above this method was defined a constructor with proper arguments.

So, when running it, the runtime log for this method shows that it executed up to run1.2 but not further.


public void onCreate(SQLiteDatabase db) {
        try{
          db = getWritableDatabase();
          db.beginTransaction();
          android.util.Log.w("check", "run1.1");
          String query = " CREATE TABLE check ( id INTEGER )";
          android.util.Log.w("check", "run1.2");
          db.execSQL(query, null);
          android.util.Log.w("check", "run1.3");
        }
        catch(Exception e){
            android.util.Log.w("check", e.toString());
        }

    }
Laur Ivan
  • 4,117
  • 3
  • 38
  • 62
Zubair_2024
  • 5
  • 1
  • 2

1 Answers1

1

Remove the second parameter of your execSQL call. This is the execSQL code from SQLiteDatabase.java:

public void execSQL(String sql, Object[] bindArgs) throws SQLException {
    if (bindArgs == null) {
        throw new IllegalArgumentException("Empty bindArgs");
    }
    executeSql(sql, bindArgs);
}

Use only:

db.execSQL(query);
Pedro Oliveira
  • 20,442
  • 8
  • 55
  • 82