开发者

how to set the simplecursoradapter to a listview in android?

开发者 https://www.devze.com 2022-12-20 00:23 出处:网络
i have to set the simpleCursorAdapter int开发者_运维问答o a listView. how can i achieve that? thanks.This question is a bit vague, so I\'m tempted to answer simply:

i have to set the simpleCursorAdapter int开发者_运维问答o a listView.

how can i achieve that?

thanks.


This question is a bit vague, so I'm tempted to answer simply:

my_list_view.setAdapter(my_cursor_adapter);

But there are better explanations and examples in the documentation. Here is one:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List2.html


ListView has the method declard as:

public void setAdapter (ListAdapter adapter)

And the documentation for ListAdapter lists SimpleCursorAdapter as one of its own indirect subclasses. So to set your SimpleCurseAdapter into a ListView, you just need call setAdapter on the view with your adapter.

0

精彩评论

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