2011年5月14日 星期六

[Android][Tip] How Twitter for Android implements auto completion in post screen?

Twitter for Android popup a user list when you enter "@" in post screen. Like this:

T1

How it implement such feature? The solution can't be simpler - You could use MultiAutoCompeleteTextView to do this.

Here is the sample codes:

And the result:

T2

To use this widget, you need to implement a Tokenizer to tell it where the sub text is. In this case, just find the string between '@' and space.

沒有留言:

張貼留言