MultiAutoCompleteTextView不显示结果 [英] MultiAutoCompleteTextView doesn't show results

查看:332
本文介绍了MultiAutoCompleteTextView不显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的code对我的活动:

I have this code on my activity:

ParseQuery<ParseUser> query = ParseUser.getQuery();
query.findInBackground(new FindCallback<ParseUser>() {
    public void done(List<ParseUser> userList, ParseException e) {
        if (e == null) {
            Log.d("score", "Retrieved " + userList.size() + " scores");
            friends = new ArrayList<String>();
            for (int i = 0; i < userList.size(); i++) {
                friends.add(userList.get(i).getUsername().toString());
            }
            aAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_dropdown_item_1line, friends);
            friendChooser.setInputType(InputType.TYPE_CLASS_TEXT);
            friendChooser.setAdapter(aAdapter);
        } else {
            Log.d("score", "Error: " + e.getMessage());             
        }
    }
});

aAdapter是一个ArrayAdapter。
结果
friendChooser是MultiAutoCompleteTextView。
结果
朋友是一个列表。
结果
用户列表是一个List

aAdapter is an ArrayAdapter. 
friendChooser is a MultiAutoCompleteTextView.  
friends is a List.  
userList is a List.

我试图得到一个 ArrayAdapter&LT;弦乐&GT; 我Parse.com用户名,并将其应用在MultiAutoCompleteTextView,问题是,我不明白对MultiAutoCompleteTextView任何结果。我怎样才能解决这个问题?

I'm trying to get an ArrayAdapter<String> of my Parse.com user's names and apply it on the MultiAutoCompleteTextView, The problem is that I don't get any results on the MultiAutoCompleteTextView. How can I solve this problem?

推荐答案

我没有与 MultiAutoCompleteTextView 取值太多的经验,但根据的你需要设置适配器之前添加此行本教程:

I don't have much experience with MultiAutoCompleteTextViews, but according to this tutorial you need to add this lines before setting the adapter:

friendChooser.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
friendChooser.setInputType(InputType.TYPE_CLASS_TEXT);
friendChooser.setThreshold(1);

然后调用:

friendChooser.setAdapter(aAdapter);

这为我工作

这篇关于MultiAutoCompleteTextView不显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆