pull to refresh in android [duplicate] - android

This question already has answers here:
Closed 10 years ago.
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..

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.

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()

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

Related

ActionBar - PullToRefresh for PullBottom and PullTop

I've checked out the famous ActionBar-PullToRefresh by ChrisBanes' and it has been clearly stated that he doesn't want to implement the pullFromBottom functionality. Then I recently found a fork on GitHub.com which implements it (https://github.com/mysms/ActionBar-PullToRefresh). It allowed me to use the pullFromTop OR pullFromBottom functionality. But I need both to be implemented into my application. Not either/or but both. Is there a way to do so?
I fixed my problem by modifying the source code itself to support what I needed.

Best alternative for SearchView for Android api level 7 and up?

I have created my app for version 4.0+ and now adding support for devices running on Android api level 7+.
I have added ActionBarSherlock for action bar and similar components; so I've solved many problems with that. However, I couldn't find a way for SearchView component. Should I create a custom view which has edit box and call it only devices which don't have SearchView?
How do you solve this problem?
See this from Android developers site.
PS: Not as per your question, but ABS is deprecated since last Android API. Google rolled out their own implementation of comaptible action bar.
since you use actionBarSherlock, you can use SearchViewCompat .
you can also check out this post that i've created.
if you wish to customize the way it looks on multiple android versions, you can use addTextChangedListener on the editText that you will probably use.
For that you can implement TextWatcher in your Activity

Tabs layout and Android sdk

Until now I was using TabActivity for Tabs layout.
Since this Activity is deprecated What will be the best way to form a tabs interface?
I saw many tutorials showing the use of TabFragments but this is good only for high sdk version (15 and higher).
So what objects can I use for tabs layout considering it should work with API 10 and above and of course not deprecated?
An example will be great!
As Commonsware said here ::
"Deprecated" in Android means "we think there is a better solution that you should investigate". Rarely does "deprecated" mean "it is unusable". TabHost, AFAIK, works fine on Android 4.0.
There are also project named ActionBarSherlock which demos have all the capability of the compatibility library. Source code is also available on github.
There is also this tutorial which helps you how to use TabFragement.
I faced the same question while ago too and the best solution is use ActionBarSherlock with Fragments and there is a really nice tutorial how to implement TabHost in your app which you can find here :
ActionBarSherlock:FragmentTabs.
It worked for me, hope it will work for you too : )
P.S. And one another thing, it is really good when you are building an application to look for design guidelines and the best ways you can build your app so you can take advantage of the latest news in Android App Development.

How would one implement a NumberPicker in Android API 7?

There's a NumberPicker widget in API 11, but I'm building for a minimum API of 7. How would I go about implementing one? Is there a custom widget that I can use, or is there a way to get at the components that make up DatePicker / TimePicker?
I find this one very good and flexible given that there were few ready made options available at that api level at the beginning of 2012 when this question was asked.
http://code.google.com/p/android-wheel/
EDIT:
So what if IOS has a similar looking control. That does not make this answer bad. Android is about freedom of choice. Besides, the look of this control is dependent on styles. Take away the shadow, add blue highlights and it looks identical to the Android 4 time picker which is what the OP was asking for.
I am pointing to a possible solution to a persons problem. I am NOT advocating that Android apps should look like IOS apps and I personally hate Android apps that are badly ported so they are a clone of their IOS versions. Some people really are fanboys.
copy the NumberPicker's code in API11 to your project.
xuyao's post doesn't work. The NumberPicker has API11-dependencies (android.animator.*) which cannot be easily replaced. You have to take one of the given libraries.
Perhaps this DigitSpinner class is useful...
copy the NumberPicker's code in API11 to your project.

How to Build a multi-panel User Interface in Android?

For My Android Application I need to design multi-panel User Interface, Like with android sdk
3.o newest version they provide a new Concept of FRAGMENT but our Android Board is running with sdk 2.3 version, I am Continuously searching to get this fragment thing by any other way , we need to design same fragment like design for Activity with sdk 2.3 API level-8,
I didnt get any way to do this,Like I am using TAB layout but it is from my side ,not much more comfortable.
Please give me some solution to get it
Depending on how soon you need this done, you might want to wait for the fragment SDK to be released by Google. They've said that fragments are fairly easy to package up for inclusion in older versions of Android. They said "soon". Unfortunately, there's really no way to know when "soon" is.

Categories

Resources