开发者

Android: making a custom ListView independent of adapters?

开发者 https://www.devze.com 2022-12-31 00:36 出处:网络
I am adding a local database as a cache to a remote web serv开发者_开发技巧ice in my android application to answer queries. I used ArrayAdapters before for list views to display the results from the w

I am adding a local database as a cache to a remote web serv开发者_开发技巧ice in my android application to answer queries. I used ArrayAdapters before for list views to display the results from the web service. Now with a database cache, the result could be either a Cursor(from database) or a List(from web), which means the adapter can be CursorAdapter or ArrayAdapter too. Creating two adapters for one query doesn't seem to be a good idea. So I am wondering what would be the best way to refactor my current code to add this database feature?

Thanks,


You should create a new class that extends from BaseAdapter and add that logic there.

0

精彩评论

暂无评论...
验证码 换一张
取 消