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

  • SEARCH
  • Home
  • 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 8417231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:58:59+00:00 2026-06-10T01:58:59+00:00

I am getting contact information from server when i login through account. i am

  • 0

I am getting contact information from server when i login through account. i am storing those information in SQLite, when user login second time, I don’t want to same duplicate contact inserting again into SQLite.

i tried like this but not working

boolean exist= contact_db.CheckItem(entry.getUser());               
if(!exist) {
 // insert
}else {
 // don't insert
}

code in DB class

Cursor mCursor = database.query(ContactsDB.TABLE_CONTACTS, allColumns,
                    ContactsDB.CONTACT_USERID + "= ' " + name +"'" , null, null, null, null);
    if (mCursor != null && mCursor.moveToFirst()) 
        return false;
    else return true;

How to avoid the duplicates while inserting the contacts into data base?

  • 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-10T01:59:00+00:00Added an answer on June 10, 2026 at 1:59 am

    Better would be to create a UNIQUE index for that column using UNIQUE Keyword. An example can be found here and also a simpler one can be found here.

    After creating table you have to create a UNIQUE INDEX for row as,

    CREATE UNIQUE INDEX idx_something ON Table_name 
                                              (column_name_1, column_name_2,....);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

via server API's i'm getting contact information using member of structure: char displayName[USERNAME_MAX_SIZE]; One
I am getting records from database as comma separated. I am getting contact titles
Im new to PHP and Im having trouble getting a contact from to submit
I'm trying to save some information from a user that is saved on the
I am trying to send out mails from my server without them getting into
I have an application that gets information from google calendar by getting them from
Getting this out of the way; I don't frequently do much in php or
I am getting contact details for a given phone number using the following code:
I keep getting an invalid_grant error on trying to get an OAuth token from
I have customer object contains his contact information,transaction details,address details. Here how to design

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.