Question

Possible Duplicate:
How to implement Android Pull-to-Refresh

I have implemented pull to refresh in my app which works fine in 2.2, but in 2.0 it doesn't.

I couldn't find the method 'smoothScrollBy()' in 2.0.

Can anyone please give me the solution for this issue or any other alternative? How can I acheive pull to refresh functionality like in iphone?

Thanks..

Was it helpful?

Solution

smoothScrollBy was introduced in API version 8, so it is not available in other versions. (You can see what API version a method is available in on the far right hand side of the detailed API, like here).

I'm not sure what refreshing your app has to do with smoothScrollBy though. If you have a ListView with an adapter, you can just update the contents of the adapter and call notifyDataSetChanged()

OTHER TIPS

You could also take a look to Johan Nilsson's android-pulltorefresh library:

https://github.com/johannilsson/android-pulltorefresh

It provides an out-of-the-box "pull to refresh" widget that replace the basic Android ListView.

I've also implemented a robust, open source, easy to use and highly customizable PullToRefresh library for Android. You can replace your ListView with the PullToRefreshListView as described in the documentation on the project page.

https://github.com/erikwt/PullToRefresh-ListView

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top