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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:35:23+00:00 2026-05-25T01:35:23+00:00

Hi I am creating a List View in another List View using this code

  • 0

Hi I am creating a List View in another List View using this code

package com.ltest;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class LTestActivity extends Activity {
/** Called when the activity is first created. */
String[] str1 = {"one1","two1","three1","four1","five1"};
String[] str2 = {"one2","two2","three2","four2","five2"};
String[] str3 = {"one3","two3","three3","four3","five3"};
String[] str4 = {"one4","two4","three4","four4","five4"};
String[] str5 = {"one5","two5","three5","four5","five5"};
String[][]str = {str1,str2,str3,str4,str5};
String[] ttl = {"A","B","C","D","E"};
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ListView lv = (ListView)findViewById(R.id.list_main);
    lv.setAdapter(new EfficientAdapter(this,str,ttl));
}



public class EfficientAdapter extends BaseAdapter {
    private LayoutInflater mInflater;
    private String[][] str;
    private String[] ttl;
    Context context;
    public EfficientAdapter(Context context,String[][] str, String[] ttl) {
        mInflater = LayoutInflater.from(context);
        this.str = str; 
        this.context = context;
        this.ttl = ttl;
    }

    public int getCount() {
        return str.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.custom_list,null);
            TextView tv_ttl = (TextView)convertView.findViewById(R.id.text_ttl);
            ListView InnerList = (ListView) convertView.findViewById(R.id.list);
            InnerList.setAdapter(new InnerEfficientAdapter(context, str[position])); 
            tv_ttl.setText(ttl[position]);
        } 
        return convertView;
    }

    public class InnerEfficientAdapter extends BaseAdapter {
        private LayoutInflater mInflater;
        private String[] str;

        public InnerEfficientAdapter(Context context,String[] str) {
            mInflater = LayoutInflater.from(context);
            this.str = str; 
        }

        public int getCount() {
            return str.length;
        }

        public Object getItem(int position) {
            return position;
        }

        public long getItemId(int position) {
            return position;
        }

        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = mInflater.inflate(R.layout.custom_list_second,null);
                TextView tv = (TextView) convertView.findViewById(R.id.text);
                tv.setText(str[position]); 
            } 
            return convertView;
        }
      }
     }

 }

but I found that the inner List View is not Scrolling, any one can help me ?
thanks;https://i.stack.imgur.com/uKQlZ.png https://i.stack.imgur.com/uKQlZ.png
and Image is here

  • 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-25T01:35:24+00:00Added an answer on May 25, 2026 at 1:35 am

    You should use ExpandableListView.

    Inner lists aren’t scrolling because ListView implements its own scroller and intercept all scroll gestures.

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

Sidebar

Related Questions

I have a list view that is displaying data using the gridview. This list
I am developing an application in android in which i creating a list view
Why does this attempt at creating a list of curried functions not work? def
I'm building an asp.net MVC 2 app. I have a list view which lists
I have a list view in my RoR web app. The view is a
I’ve got the following code (from a partial view), which creates a list of
Need a hand/guide of creating a view that handles a list of parameters which
Is there any way creating a photo gallery using Listview control ? Im playing
When creating a website using Asp.Net and using controls such as the ListView is
I am using XML file for creating Context Menu for my ListView. (Please see

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.