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.
精彩评论