I would like to know when to use each Adapter. According to my experience, and this article BaseAdapters are useful when I am getting data from an API for example, and I store it in a Collection object. However a CursorAdapter is used to query contents from a database, phone agenda...In general, contents which have also a content provider to query the info out of them.
So basically a BaseAdapter is used to queries that dont have a content provider to access them, because in that case a CursorAdapter will be the best choice. Is that right?
Here is the difference: BaseAdapter is a very generic adapter that allows you to do pretty much whatever you want. However, you have to do a bit more coding yourself to get it working. ArrayAdapter is a more complete implementation that works well for data in arrays or ArrayList s.
An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. Adapter that exposes data from a Cursor to a ListView widget.
BaseAdapter,ArrayAdapter,SimpleAdapter etc are mostly used if you are getting dynamic data from a remote connection (like a web service or API) and can be modified as your wish.
CursorAdapter is mostly used for local files or database to query the database and the content of it. In your case CursorAdapter seems like the one to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With