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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:59:58+00:00 2026-05-17T02:59:58+00:00

I have a database with 3 tables in it. They are Projects, Contacts and

  • 0

I have a database with 3 tables in it. They are “Projects”, “Contacts” and “Project Types”. I have a UI for creating (adding a record) a new project which adds a record to the “Projects” table. In that UI, I have a button to fetch Contact Names from the “Contacts” table which in turn displays a ListView of all Contacts. When the name is selected, it should go back to the Projects UI and the name has to be displayed in the EditText. However, i keep getting this in the EditText: android.database.sqlite.SQLiteCursor@43d34310

Am attaching code snippets to the post for advice.

The ListActivity onCreate() code:

public class ContactsList extends ListActivity {
DBAdapter dbContactList;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.editproject_list);

    dbContactList = new DBAdapter(this);
    // Pull the data from the database
    String[] fields = new String[]    {    dbContactList.TABLE_CON_NAME    };
    int[] views = new int[]    {    android.R.id.text1    };

    Cursor c = dbContactList.getAllContacts();
    startManagingCursor(c);

    // Set the ListView
    ListAdapter prjName = new SimpleCursorAdapter(this,
            android.R.layout.simple_list_item_1, c, fields, views);
    setListAdapter(prjName);

    dbContactList.close();
}

The onListItemClick code:

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    // Get the item that was clicked

    Intent selectedContact = new Intent();

    Object o = this.getListAdapter().getItem(position);
    String keyword = o.toString();

    selectedContact.putExtra("selectedcontact", keyword);

    setResult(RESULT_OK, selectedContact);
    finish();

}

And the Projects UI code to start the activity for the ListView and for getting the results:

public void onClickContactPicker(View target)
{
    Intent contactPicker = new Intent(this, com.dzinesunlimited.quotetogo.ContactsList.class);
    startActivityForResult(contactPicker, contact);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    String contact = data.getExtras().getString("selectedcontact").toString();

    ((EditText)findViewById(R.id.txtProjectContacts)).setText(contact);
}

This is the query() from the DB Adapter

public Cursor getAllContacts()
{
    Cursor cursor = null;

    try
    {
        cursor = db.query(TABLE_CONTACTS, new String[] {  
                TABLE_CON_ID, TABLE_CON_NAME, TABLE_CON_EMAIL,
                TABLE_CON_EXPERTISE, TABLE_CON_CHARGES}, 
                null,
                null, 
                null, 
                null, 
                null);
    }
    catch (SQLiteException e)
    {
        Log.e("Database.addRow", "Database Error: " + e.toString());
        e.printStackTrace();
    }

    return cursor;
}

Please advice on the solution to this.

Thanks in advance.

  • 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-17T02:59:59+00:00Added an answer on May 17, 2026 at 2:59 am

    Object o = this.getListAdapter().getItem(position);

    At this point, o is a Cursor, positioned at the correct row.

    String keyword = o.toString();

    At this point, keyword is going to look something like android.database.sqlite.SQLiteCursor@43d34310, because that is what you get when you call toString() on a Cursor.

    Perhaps you should be calling getString() with some column index instead.

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

Sidebar

Related Questions

I have 3 database tables, all of them have the same 5 columns. They
I have multiple tables in a MySQL database. Lets say they look like this:
I have a database two tables and a linking table that I need a
I have this enormous database : # # Dropping tables # DROP TABLE IF
I have a database with many tables and one particular table has columns: name
I have a database that has two tables, one of which contains a foreign
I have a reporting database for which most of its tables/views/functions are based on
I have a project here that connects to an in-production database and grabs tables
I have two database tables, 1st is the TABLE_GLOBAL_PRODUCTS where all products information are
I have two database tables with the following structure: actions: action_id int(11) primary key

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.