tags:

views:

943

answers:

3

I am porting an iPhone app over to the Android platform. One of the views has a very large list of data and on the iPhone app, there's a scrollbar of sorts on the right hand side that displays the letters of the alphabet and allows the user to quickly scroll through the list this way. I am having trouble finding such functionality in Android. Is there a simple way to implement this?

+1  A: 

The Android way to do this is to make the list filterable using the keyboard, like a Blackberry. You should do it this way to fit in with the platform experience.

To implement this, you call the setTextFilterEnabled(boolean textFilterEnabled) method on your list view. See example below:

myListView.setTextFilterEnabled(true);

For a complete example, see Hello, ListView.


If you can't use that, then you can use the fast scrolling like seen in the Contacts application. This is not a public API yet, but you can implement it from the Contacts source code at http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git;a=summary.

Isaac Waller
I enabled this and it takes an extremely long time for the internal filtering to work and filter the results given the volume of data. I am implementing a different kind of filter at the client's request, but I really wanted to be able to quickly scroll through the list by the first letter of each item like you can in large table views on the iPhone.
MattC
I see. What you need then is the FastScrollView, I'll update my answer.
Isaac Waller
+1  A: 

I think this is implemented through AlphabetIndexer, though I have not tried it personally.

If you search for Android stuff via Google Code Search, you'll find a few uses of this class.

CommonsWare
A: 

can anybody please give me example of using similar functionality like uitableview in iphone to in android?

mm6264
This would be a separate question, it is not an answer to this question here. So better post it as a new, separate question, more people will see it this way.
sth