The question arises from the way I have created a file explorer functionality for an application (my first).
Can some of you please help me know which of the following below mentioned approaches is better vis-à-vis performance.
Case I - There is an approach which advises to override the getView() method. Like the one given here.
Case II - I used a different one where I have a custom method (not getView) in my adapter class with
(I must say I have to do extra iterations to sort the list folder/file wise and then alphabetically within folders and files. I went the long way sorting, did not use comparator)
My code is close to as given here
Case III* OR, is there any thing better than the above two approaches?
Thanks.
Personally I would create my own adapter and override the getView method. The reason is that you will get much better flexibility and control over what you can do with the class. For instance, if you change your data structures that you back the data with it will be easy to handle. You could eventually want to do some sort of algorithm where you rely on caching the contents of a folder for a period of time and doing so will be more difficult with a SimpleAdapter. A SimpleAdapter saves you a few lines of code that you'd need to write in getView but overall I don't think it's going to really help you that much. There are certain things that you should make sure to do though to make your listview fast, such as using viewholders.