Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 838
MistyD Avatar asked Mar 24 '13 10:03

MistyD


People also ask

What is the difference between BaseAdapter and ArrayAdapter?

Here is the difference: BaseAdapter is a very generic adapter that allows you to do pretty much whatever you want. However, you have to do a bit more coding yourself to get it working. ArrayAdapter is a more complete implementation that works well for data in arrays or ArrayList s.

Is the default layout in Android Studio?

The Constraint layout is the default layout used in Android.


1 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)
like image 193
Emil Adz Avatar answered Oct 28 '22 05:10

Emil Adz