If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.

activity.OnCreate is executed every time the app launches or the screen is rotated, so, putting your DB initialization inside it will cause the DB to be called too many times causing the exception. Try to use the MyDatabase.onCreate method for this.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Android Xml data parsing
    via Stack Overflow by hashim
  • Android database method was called twice
    via Stack Overflow by user4901016
  • Errors when running
    via Stack Overflow by Alexia White
  • sending attachment failed
    via GitHub by Safari77
  • backup database causes crash
    via GitHub by rahu
  • Android 1.5 crash issue
    via GitHub by mucek4
    • android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: (code 2067) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId( at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId( at android.database.sqlite.SQLiteStatement.executeInsert( at android.database.sqlite.SQLiteDatabase.insertWithOnConflict( at android.database.sqlite.SQLiteDatabase.insert( at com.example.yasser.ahlysc.MyDataBase.AddnewContact( at com.example.yasser.ahlysc.Funny$1.onResponse( at com.example.yasser.ahlysc.Funny$1.onResponse( at at at$ at android.os.Handler.handleCallback( at android.os.Handler.dispatchMessage( at android.os.Looper.loop( at at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke( at$ at

    Users with the same issue

    60 times, last one,
    1 times, last one,
    Unknown UserUnknown User
    1 times, last one,
    Hiren AmaliyarHiren Amaliyar
    1 times, last one,
    Indri YunitaIndri Yunita
    20 times, last one,
    68 more bugmates