Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StableArrayAdapter vs ArrayAdapter

I am looking at this ListView Tutorial:

ListView Tutorial

and I was wondering how much better is to create my own ArrayAdapter, rather than just using and ArrayAdapter.

In the Tutorial it defines a "StableArrayAdapter", what exactly does this means? If I use a regular ArrayAdapter, could it be dangerous for some reason?

like image 977
Gabriel Matusevich Avatar asked Dec 02 '22 22:12

Gabriel Matusevich


1 Answers

The two previous answers are absolutely right, but just to address more directly your question and in case someone else has the same doubt than you; a regular ArrayAdapter is not dangerous at all, the only "problem" is that it might not fulfill your needs, in which case you will have to create your own adapter, as the author of the tutorial did by creating what he called StableArrayAdapter in the end of the ListViewExampleActivity class.

Don't get lost by the name, which I guess comes from the fact that the overwritten method "hasStableIds" always returns true, it doesn't mean that the regular ArrayAdapter creates problems.

like image 82
AlvaroSantisteban Avatar answered Dec 26 '22 01:12

AlvaroSantisteban