来自TokenAutoComplete库的Android getText

时间:2014-11-11 12:00:35

标签: android

我使用TokenAutoComplete并且在通过单击按钮填充EditText后无法从此库中获取文本。请帮我从中获取数据

的活动:

public class TokenActivity extends Activity  implements TokenCompleteTextView.TokenListener {
    ContactsCompletionView completionView;
    Person[] people;
    ArrayAdapter<Person> adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.token);

        people = new Person[]{
                new Person("amanda Johnson", "amanda  example com"),
                new Person("terry Anderson", "terry  example com")
        };

        adapter = new ArrayAdapter<Person>(this, android.R.layout.simple_list_item_1, people);

        completionView = (ContactsCompletionView)findViewById(R.id.searchView);
        completionView.setAdapter(adapter);

    }

    @Override
    public void onTokenAdded(Object token) {
        Log.e ( "------->", String.valueOf ( token ) );
    }

    @Override
    public void onTokenRemoved(Object token) {
        Log.e ( "------->>>", String.valueOf ( token ) );
    }
}

1 个答案:

答案 0 :(得分:0)

可以从getObjects获得completionView中的对象。您是否想要从中获取原始文本?