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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:00:44+00:00 2026-06-10T16:00:44+00:00

What I am trying to do is populate one listview, from two different tables

  • 0

What I am trying to do is populate one listview, from two different tables in my database. The tables that I am using are:

--------------------------
|UNIT_TABLE|SHOVEL_TABLE |
|ID        |ID           |
|SITE_NAME |SITE_NAME    |
|UNIT_NAME |SHOVEL_NAME  |
--------------------------

The id is used in all my tables, as a basic autoincrement not null, the SITE_NAME is the name of the where the UNIT_TABLE and SHOVEL_TABLE are being completed at.

After some research on the best option I decided to use the following code to create a join on the two tables using the SITE_NAME to determine which ones I need.

SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    String[] queries=new String[]{"select "+ID+", "+SHOVEL_NAME+" from "+SHOVEL_TABLE+" where "+SITE_NAME+"='"+Site+"'",
            "select "+ID+", "+ UNIT_NAME+" from "+UNIT_TABLE+" where "+SITE_NAME+"='"+Site+"'"};
    String SQL= qb.buildUnionQuery(queries, null, null);

This allowed me to combine all the data into one table, and populate my listview using a SimpleCursorAdapter. However, when I click on a list item, it takes me to the same activity. What I need it to do is if the item came from the SHOVEL_TABLE to go one Shovel.class, and if it came from the UNIT_TABLE I need it to go Unit.class.

Looking for any suggestions.

  • 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-10T16:00:46+00:00Added an answer on June 10, 2026 at 4:00 pm

    i assume that you use an adapter in populating your listview right?, den i guess in your adapter, you can put added info for your listitemlistener to take note on.

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

Sidebar

Related Questions

I am trying to populate ListView Item with an object from MyClass. One of
I am trying to populate a list of 8 Ingredient objects using one list
So this sucks. Trying to populate a core data database with info from NSDictionaries.
I am currently trying to populate a treeview from xml that is returned to
I am trying to populate one table from another table with mysql. First table
I am trying to populate a list box from a list in python using
I am trying populate H3 with the sum of column E for rows that
I am trying to populate a ListView ....but I cant add 2 string values
I am trying to populate the list li from the LoginAction on to the
I am trying to populate a dropdown select with an array using jQuery. Here

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.