如何从MultiAutoCompleteTextView中检索String

时间:2013-08-28 09:54:47

标签: android

我正在使用MultiAutoCompleteTextView,我想在MultiAutoCompleteTextView中附加所选文本, 我正在尝试

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {

            Map<String, String> map = (Map<String, String>) arg0
                    .getItemAtPosition(arg2);


            String name = map.get("Name");
            String number = map.get("Phone");
            automulti.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());


            Log.d("ad:", automulti.getText().toString());
            automulti.append(", " + name  );




        }

2 个答案:

答案 0 :(得分:0)

试试这段代码,

MultiAutoCompleteTextView myEditText = (MultiAutoCompleteTextView)findViewById(R.id.mymulti);
     String stringEditText = MultiAutoCompleteTextView.getText().toString();

答案 1 :(得分:0)

试试这个。

 MultiAutoCompleteTextView myEditText = (MultiAutoCompleteTextView)findViewById(R.id.mymulti);
   String stringEditText = myEditText.getText().toString();