Home » Android » android – Default layout for ArrayAdapter

android – Default layout for ArrayAdapter

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am currently using an array adapter. All the examples that I came across online use a separate layout for the array adapter. I wanted to know if it had a default layout. My code is something like this

ArrayAdapter<String> adapt = new  ArrayAdapter<String>(this,,item);

What should the second parameter so that I dont specify a resource layout and it uses its default ?

How to&Answers:

You can use the defalut one TextView row item:

android.R.layout.simple_list_item_1

like so:

   ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items)