开发者

How to feed data to PagerAdapter

开发者 https://www.devze.com 2023-03-29 20:47 出处:网络
I am using this example to use a ViewPager and a PagerAdapter. But how could I feed the PagerAdapter with data from a adapter like CursorAdapter where I load the data using a CursorLoader?

I am using this example to use a ViewPager and a PagerAdapter. But how could I feed the PagerAdapter with data from a adapter like CursorAdapter where I load the data using a CursorLoader?

The .setAdapter() on the ViewPager only takes a PagerAdapter. Then I would guess I need to bind the CursorAdapter within开发者_JS百科 the PagerAdapter, but I could not find a way doing this.


Here's a blog post where I offer the source code for a CursorPagerAdapter which does what you appear to want.


You don't need the CursorAdapter, just use the Cursor to populate the views in the PagerAdapter.

0

精彩评论

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