Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BaseAdapter vs CursorAdapter

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?

like image 716
Dayerman Avatar asked Nov 17 '11 09:11

Dayerman


People also ask

What is the difference between BaseAdapter and ArrayAdapter?

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.

What is Cursoradapter in android?

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.


1 Answers

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.

like image 59
Serdar Dogruyol Avatar answered Sep 28 '22 14:09

Serdar Dogruyol