Cursoradapter not updating base tables

Rated 4.75/5 based on 560 customer reviews

But as You have just read implementing Cursor Adapter is not so hard at all and bind View method that is called plenty of times in Simple Cursor Adapter implementation it has to check what type is view element it is working on now (Image View or Text View) to call correct method.

Plus it don't gets values directly from cursor but uses View Binder.

If You are going to create a view for Your list elements in code rather than in xml You have to use first one.

If You define a layout in xml You can use either of them but if You go with second one You will have 3 lines of code less to write./ I will extend a Cursor Adapter and explain what differences there are in comments.

If we were to use Resource Cursor Adapter we could omit this step, implementation I am going to show You here is copy-paste(with little alteration) from Resource Cursor Adapter.

As I said before I You were to extends Resource Cursor Adapter these are 3 lines of code You wouldn't have to write.

If You choose to create view in Java instead of defining it in xml Your new View method will be a bit more complex, but You don't need inflater instance.Now it is time to bind data to view crated in previous step.First You get element to populate by calling View By Id(), cast it to correct type, and set value. You go on like this for each value/element You have and wish to display.In short custom adapter is simple in code and more flexible, Simple Cursor Adapter is simple in use and that is all.The only scenario where Simple Cursor Adapter will come handy is if Your application will have many List View with many different layouts and it may be not worth it to create custom adapter for each case.

Leave a Reply