0
ListView list = (ListView) findViewById(R.id.listView1);

ArrayAdapter<String> dataAdaptor = new ArrayAdapter<String> (this, android.R.layout.simple_list_item_1, android.R.id.text1, cars); 

list.setAdapter(dataAdaptor);

I write that codes for listview but I don't know how I get data for subitem. How can I do this?

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Enes
  • 301
  • 2
  • 7
  • 15

1 Answers1

1

A ListView item can have it's own custom layout. When you create your adapter for the ListView you can pass in the layout id to the Adapter constructor.

If you want to show some more details like image and text or two textview then You will have to extend an Adapter and implement getView() to property set the image+text.

please check this answer with examples.

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142