androidandroid-arrayadapter

Default layout for ArrayAdapter


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 ?


Solution

  • 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)