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 3608378
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:29:38+00:00 2026-05-18T21:29:38+00:00

I am trying to make a SQLite table for group of contacts, but I

  • 0

I am trying to make a SQLite table for group of contacts, but I do know the number of contacts that are going to be in that table, so how could I account for ALL the contacts? I could make a single TEXT column and have the String URI of each contact with a delimeter. I would like to support the wide range of users running Android 1.5 and (correct me if I’m wrong) the version of SQLite that runs on Android 1.5 doesn’t support foreign keys (only Android 2.2 and above). What should I do?

  • 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-05-18T21:29:38+00:00Added an answer on May 18, 2026 at 9:29 pm

    You can simulate foreign key constraints on older versions of android using triggers: http://www.codeproject.com/KB/android/AndroidSQLite.aspx

    From there, you can simply have another table for the groups (and whatever metadata you wanted associated to it), and then another for contacts, and have each contact have a group_id, or if you want multiple groups per contact, you could also have another table containing only contact_id and group_id.

    So, let’s say you want a set of contacts, and you want a set of contact groups. And you want each group to contain a variable amount of contacts, and you want a contact to be in a variable ammoun of groups, you will want three tables, a group table, a contact table, and a groupcontact table. The group table will have all of the columns that a group needs, plus an additional primary key column (note that it has to be called _id because android assumes it will be called _id). The contact table will have all of the columns needed for a contact, plus an additional primary key. Finally, the groupcontact table will have three columns (although you only care about two of them), a primary key column, a group_id column, and a contact_id column.

    Finally, if you want to associate all of the elements of a group, including all of the contacts, you could do something like this:

    <group_fileds>, <contact_fields> from <group_table>, <contact_table>, <group_contact_table> where <group_table>._id = <groupid> and <contact_table>._id = <contactid>
    

    Where and are from the groupcontact table. (Note that android has methods demonstrated in their notepad example: http://developer.android.com/resources/samples/NotePad/src/com/example/android/notepad/NotePadProvider.html , also you can see an example of things similar (although a bit simpler) in a recent provider I wrote (although I haven’t implemented triggers yet, so it won’t work properly in older versions of android): https://github.com/LeifAndersen/NetCatch/blob/master/src/net/leifandersen/mobile/android/netcatch/providers/ShowsProvider.java

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

Sidebar

Related Questions

I am trying to make a contacts table in SQLite. When i commit the
I'm trying to make some utils for using with sqlite databases. For that I
I trying to make method to alter table. I've build data.db Created new group
I'm just trying to make a simple function that will return all the data
I'm trying to make a hierarchical list with PHP and an SQLite table setup
Trying to make a make generic select control that I can dynamically add elements
Trying to make a custom :confirm message for a rails form that returns data
I'm trying to use DbLinq with a SQLite database, but I'm running into a
I'm trying to make a database in android but I have this problem,erase the
I'm using PDO and trying to make my application support both MySQL and SQLite,

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.