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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:58:38+00:00 2026-05-26T18:58:38+00:00

I am storing information on the phone’s contacts using a sqlite database. The fields

  • 0

I am storing information on the phone’s contacts using a sqlite database.
The fields I am storing are: _id, contact_id, body where _id is the row’s id, contact_id is the phone contact’s id and body is just a simple text which is the actual information I am storing.

I’m using a SimpleCursorAdapter to map the data to the view, like so:

Cursor cursor = database.fetchInformation(); // fetch info from DB
    String[] from = new String[] { CONTACT_ID, BODY };
    int[] to = new int[] { R.id.contact, R.id.body };

    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
    getListView().setAdapter(adapter);

What I would actually want is to get the contact name that is associated with this CONTACT_ID, and have that be shown in the view.

I can’t seem to find a simple solution. I’ve tried implementing my own SimpleCursorAdapter and rewriting setViewText(TextView, String) but it didn’t work. Also, it just seems overly complicated for such a simple task.

Any help? Thanks.

  • 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-26T18:58:39+00:00Added an answer on May 26, 2026 at 6:58 pm

    You really have two options here:

    1) You could create a MatrixCursor that contains all the information you wish to bind to your ListView. While its not very difficult to do this, its probably not the most efficient use of memory because you would need to get the name of every contact in your cursor.

    2) You could subclass from CursorAdapter. Its pretty simple to implement the appropriate newView and bindView methods. Inside of bindView you would simply query the phone’s contact content provider to get the name of the contact currently being bound.

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

Sidebar

Related Questions

I have an app with an SQLite database for storing information for a user's
I'm dynamically storing information in the database depending on the request: // table, id
I'm storing some additional per-user information using the AUTH_PROFILE_MODULE . We can access the
I am trying to query contact information based on a phone number on android
I am trying to streamline a complex process of storing information in multiple tables
I have 2 tables - one storing user information (id, username, password) and the
Storing credit card information securely and legally is very difficult and should not be
For ASP.Net application deployment what type of information (if any) are you storing in
Im storing columns in database with users able to add and remove columns, with
i need to read the proxy information from the phone and if the phone

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.