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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:34:37+00:00 2026-05-30T11:34:37+00:00

My scenario: I am populating a ListView in an activity that is displaying a

  • 0

My scenario:

I am populating a ListView in an activity that is displaying a list of city names. When I select a city name, I am launching a new activity that will display the name of the city in a TextView header. This is working perfectly, using a “getIntent” call in my new activity.

I then want to populate another ListView in my new activity listing all the streets in the city.

Here is my problem. In my database, I have a table of city names that I am calling in my first activity. The fields within this table representing the city names contain spaces (example, San Francisco).

My though was to pass this data to the new activity, and then package the results in a new rawQuery command to query the street names that exist within another database table that would contain all the streets for a specific city. The issue is that table names cannot contain spaces (so my table is named SanFrancisco). That’s fine, except I don’t want to display “SanFrancisco” in my first activity, I want to display “San Francisco”.

Would the solution to create another field within my List of Cities table that would contain the non-space version of the city word, and pass that to the new activity as well? If so, how would I do that considering I don’t display that in my initial ListView?

  • 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-30T11:34:38+00:00Added an answer on May 30, 2026 at 11:34 am

    ADK,
    You don’t want to create separate tables for each of your cities. All you need are 2 tables and you can add as many cities and streets as you want and you can even still use spaces if you want to keep passing the full city name.

    You just need 2 tables: “City” and “Street”.

    CREATE TABLE City (_id INTEGER PRIMARY KEY, city_name TEXT);
    INSERT INTO City VALUES(1,'San Francisco');
    INSERT INTO City VALUES(2,'Los Angeles');
    INSERT INTO City VALUES(3,'Munich');
    
    CREATE TABLE Street (_id INTEGER PRIMARY KEY, city_id INTEGER, street_name TEXT);
    INSERT INTO Street VALUES(1,1,'Main Street');
    INSERT INTO Street VALUES(2,1,'Haight street');
    INSERT INTO Street VALUES(3,2,'Sunset Blvd');
    INSERT INTO Street VALUES(4,3,'Maximilian Street');
    

    Here’s the query to run:

    select c._id as id, c.city_name as city_name, s.street_name as street_name
    from City c join Street s on c._id=s.city_id
    where c.city_name='San Francisco'
    

    If you want to switch from passing the full city name to the city’s unique id when someone clicks the row, you just need to change the last line in the SQL statement to “where c._id=1”.

    There are easy ways to do the queries with Android content providers so you should look that up too.

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

Sidebar

Related Questions

Scenario: You have an ASP.Net webpage that should display the next image in a
Scenario: I am using a listview with custom Adapter. I am fetching data every
Scenario is that we send out thousands of emails through SMTP server. Content is
Scenario: An event is raised in class A that needs to be handled by
Scenario: I have an application (C#) that expects a SQL database and login, which
Scenario: Most smartphones have a high resolution camera that generates photos that may range
I have the following scenario. I have two methods of populating a GridView with
Scenario: I have a link that is example/directory/go.php I am 301 redirecting that link
Scenario: An asynchronous task in a loop executes a method containing arguments that change
Scenario Activity A (login) starts activity B then finish(); Activity B calls startActivityForResult(Activity C)

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.