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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:37:47+00:00 2026-06-17T08:37:47+00:00

I have a ListView: A B C D I am trying to show a

  • 0

I have a ListView:
A
B
C
D

I am trying to show a second ListView once an item is selected from the first. I tried the following:
A b1
B b2
C b3
D

It’s working but I didn’t like the look of it. How can I implement the list in such a way that the second ListView (b1-b2-b3) shows up under the selected item by moving the rest below:
A
B
b1
b2
b3
C
D

Also I have another question, how can I introduce a new String array depending on the selected item. Currently I am using a switch clause but it will be problematic if I happen to need more arrays:

String[] brands = { ... };    String[] test2 = { ... };

    ArrayAdapter<String> arrayAdapterOne = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, brands);
    final ArrayAdapter<String> arrayAdapterTwo = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, test2);
    final ArrayAdapter<String> arrayAdapterThree = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, test3);
    final ArrayAdapter<String> arrayAdapterFour = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, test4);


listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            TextView tv1 = (TextView) findViewById(R.id.textView1);
            tv1.setText(brands[position]);
            switch (position) {
            case 0:
                listView2.setAdapter(arrayAdapterTwo);
                break;
            case 1:
                listView2.setAdapter(arrayAdapterThree);
                break;
            case 2:
                listView2.setAdapter(arrayAdapterFour);
                break;
            case 3:
                listView2.setAdapter(arrayAdapterFour);
                break;

            }
        }
    });
  • 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-17T08:37:48+00:00Added an answer on June 17, 2026 at 8:37 am

    I don’t think thats possible (had nearly the same issue), I would recommend using an ExpandalbeListView instead.
    This should provide all (or nearly similar) features you are trying to implement

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

Sidebar

Related Questions

I am trying to implement ListView with Delete functionality to delete item from the
I'm trying to pass KEY_THUMB_URL to SingleMenuItemActivity.class to show Image onclick listview. I have
I am trying to select an item in a listview and show the user
I have created a dynamic listview with lazy loading. I am trying to show
basicly, I'm trying to show the result of a listview (created with QSLite)but in
I have a listview that I'm populating with data and I'm trying to get
I have a WPF ListView that I am trying to filter within a BackgroundWorker.
I have been trying to create a ListView which I can sort using drag
I am trying to display ListView . I have created one activity , in
I'm trying to launch an activity from a custom lisview. I have hoded the

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.