Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:26:35+00:00 2026-06-09T03:26:35+00:00

08-02 16:26:24.750: E/Database(28841): Error inserting data 08-02 16:26:24.750: E/Database(28841): android.database.sqlite.SQLiteConstraintException: error code 19: constraint

  • 0
08-02 16:26:24.750: E/Database(28841): Error inserting data
08-02 16:26:24.750: E/Database(28841): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
08-02 16:26:24.750: E/Database(28841):  at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
08-02 16:26:24.750: E/Database(28841):  at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
08-02 16:26:24.750: E/Database(28841):  at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1584)
08-02 16:26:24.750: E/Database(28841):  at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1428)
08-02 16:26:24.750: E/Database(28841):  at com.app.android.DataOperations.insertItems(DataOperations.java:69)
08-02 16:26:24.750: E/Database(28841):  at com.app.android.DownloadTask.createDatabase(DownloadTask.java:173)
08-02 16:26:24.750: E/Database(28841):  at com.app.android.DownloadTask.doInBackground(DownloadTask.java:59)
08-02 16:26:24.750: E/Database(28841):  at com.app.android.DownloadTask.doInBackground(DownloadTask.java:1)
08-02 16:26:24.750: E/Database(28841):  at android.os.AsyncTask$2.call(AsyncTask.java:185)
08-02 16:26:24.750: E/Database(28841):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
08-02 16:26:24.750: E/Database(28841):  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
08-02 16:26:24.750: E/Database(28841):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
08-02 16:26:24.750: E/Database(28841):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
08-02 16:26:24.750: E/Database(28841):  at java.lang.Thread.run(Thread.java:1019)

Above is my LogCat report. What I am trying to do is to insert data. After looking at the logcat I found that it is a constraint violation. I tried to put my code as:

public void insert(...){
            long insertID = 0;
            try{
                Log.i("DataOperation", String.valueOf(insertID));
                insertID = sqllitedb.insert(DBase.TABLE_NAME, null, contentValues);
            }catch(android.database.sqlite.SQLiteException ex){
                Log.i("dataops_", "Error Constraint"); //Print
            }

}

Nothing is happening.. My logcat is full of stacktraces. No Sign of the line with comment(see above).

How can it be handled.
N.B. There is only one insert satements(which is above) in my whole program. Test Ok then I will proceed.

Also tell me how to handle whether my database is created/already exists so that if exists I will not run my DownloadTask.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:26:37+00:00Added an answer on June 9, 2026 at 3:26 am

    You need to use a android.database.sqlite.SQLiteConstraintException instead of a android.database.sqlite.SQLiteException

    If this doesn’t work, try and catch any exception with Exception to see if the catch block is being called.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use an in-memory SQLite database to test my data layer which
I have some 750 rows in my sqlite table. I am adding a new
This is my code: function transition(index){ $(#right-panel).find(img).each(function(){ if ($(this).index() === index){ setTimeout(function(){ $(this).fadeIn(750); },
in my app i am trying to fetch some data from database and i
$('a#city-prompt').fancybox({ 'width': 750 }); /*$('#city-prompt').trigger('click');*/ The code as is, works good, but when I
i got code like this: swfobject.embedSWF(/Content/open-flash-chart.swf, my_chart, 750, 300, 9.0.0, expressInstall.swf, {data-file:http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123&param2=456} ); The
I have a database program on a spreadsheet with data classically ordered in rows
Table1 Date id salary 01/2012 001 1500 01/2011 001 750 01/2010 001 500 from
I have a server running a 3gb JVM with a 750 meg permgen space.
I have a query: select substr(name,7,50) as location, points,sum(if (p1=r1,10,-10))as total from dq.data group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.