title: ListView inside a listView Item
body: <p>I wanted to use a list view inside a list view item. The code is provided below.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>String[][] topicLists = {{"one,one","one,two","one,three","one,four","one,five"}
                              ,{"two,one","two,two","two,three","two,four"}
                              ,{"three,one","three,two","three,three","three,four","three,five","three,six"}
                              ,{"four,one","four,two","four,three"}};
  
      ListView listView = (ListView) findViewById(R.id.recyclerView);
      CardsAdapter cardsAdapter = new CardsAdapter(this, topicLists);
      listView.setAdapter(cardsAdapter);
  </code></pre>
  
  <p><strong>CardsAdapter.java</strong></p>
  
  <pre><code>String[][] allTopics = {};
  
  public CardsAdapter(@NonNull Context context, String[][] unitsAndTopics) {
      super(context, 0,unitsAndTopics);
      allTopics = unitsAndTopics;
  }
  
  @Nullable
  @Override
  public Object getItem(int position) {
      ArrayList&lt;String&gt; all = new ArrayList&lt;String&gt;();
      for (int i = 0; i &lt;allTopics[position].length ; i++) {
          all.add(allTopics[position][i]);
          Log.e("",allTopics[position][i]);
      }
  
      return all;
  }
  
  @NonNull
  @Override
  public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  
      View listItem = convertView;
      if (listItem==null)
          listItem = LayoutInflater.from(getContext()).inflate(R.layout.card_view,parent,false);
  
      ArrayList&lt;String&gt; currentItem = (ArrayList&lt;String&gt;) getItem(position);
  
      ListView topic = (ListView) listItem.findViewById(R.id.listView);
      ListAdapter listAdapter = new ListAdapter(getContext(),currentItem);
      topic.setAdapter(listAdapter);
  
      return listItem;
  }
  </code></pre>
  
  <p><strong>ListAdapter.class</strong></p>
  
  <pre><code>    public ListAdapter(@NonNull Context context, ArrayList&lt;String&gt; topics) {
      super(context, 0,topics);
  }
  
  @NonNull
  @Override
  public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  
      View listItem = convertView;
      if (listItem==null)
          listItem = LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false);
  
      final String currentItem = (String) getItem(position);
  
      TextView topic = (TextView) listItem.findViewById(R.id.topic_text_view);
      topic.setText(currentItem);
  
      Button search = (Button) listItem.findViewById(R.id.search_button);
      search.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              try {
                  Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
                  String term = currentItem;
                  intent.putExtra(SearchManager.QUERY, term);
                  getContext().startActivity(intent);
              } catch (Exception e) {
                  // TODO: handle exception
              }
          }
      });
  
      return listItem;
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/h2X2x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h2X2x.png" alt="The list live have only first element"></a></p>
  
  <p>In the above image, the only first element of all the arrays is present in the list. rest all are not showing up
  Any suggestion ll be helpful.</p>