Search code examples
androidandroid-listviewandroid-arrayadapter

Android - Modify displayed text in ListView items


I have a ListView loaded with an ArrayAdapter<File> and it shows the file path as the text of each item.

I would like to modify that.

I've read about modifying the getView() method from a custom ArrayAdapter but I am not sure if this is the correct path yet.

Any aid?

Thanks.


Solution

  • You need to return to implement your own ArrayAdapter and Override the getView method to return your own view.

    Find an example here:

    https://github.com/codepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView