我正在编写一个应用程序,它将使用 Java Mail 外部库发送电子邮件。我搜索了一周关于如何向用户显示电子邮件地址建议,例如 Gmail 中显示的建议。
任何帮助都是合适的!
最佳答案
获取电子邮件列表并使用自动完成 TextView 在您键入时显示它们。
为文本框设置适配器:
ArrayAdapter<String> namesAdapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_dropdown_item_1line, names);
searchBox.setAdapter(namesAdapter);
searchBox.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
String email = searchBox.getText().toString(); //or use the position to reference the email address you want.
});
}
关于android - 我如何在输入 "To"文件时获得电子邮件地址的建议?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11169993/