博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AutoCompleteTextView获取其内容
阅读量:4172 次
发布时间:2019-05-26

本文共 879 字,大约阅读时间需要 2 分钟。

我想获取在AutoCompleteTextView中显示的被选择到的内容 然后返回给另一个活动
final AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.ac_university);
String[] universities = myDbHelper.getAllUnis(db);
// Print out the values to the log
for(int i = 0; i < universities.length; i++)
{
Log.i(this.toString(), universities[i]);
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, universities);
textView.setAdapter(adapter);
//textView.setOnItemSelectedListener(this);
textView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Intent intent = new Intent(Main.this, Campus.class);
Bundle bundle = new Bundle();
bundle.putString("university_name", arg0.getItemAtPosition(arg2).toString());
bundle.putLong("_id", arg3);
intent.putExtras(bundle);
startActivity(intent);
}

转载地址:http://arbai.baihongyu.com/

你可能感兴趣的文章
HBase学习和使用
查看>>
LSTM
查看>>
牛客网 数字游戏
查看>>
逆波兰表达式
查看>>
逆波兰表达式
查看>>
K-means中K值的选取
查看>>
kmeans优化算法
查看>>
牛客网 构造队列
查看>>
牛客网 跳石板
查看>>
牛客网 最大的奇约数
查看>>
python大坑:AttributeError: 'module' object has no attribute 'Workbook'
查看>>
python 协程
查看>>
在写计算器时学到的
查看>>
小Q的歌单
查看>>
牛客网 计算机网络 选择题及知识点 (1)
查看>>
0-1背包问题
查看>>
TCP-IP详解卷1:协议 学习笔记(5) RARP ICMP
查看>>
Java核心技术 卷I 基础知识 学习笔记(3)
查看>>
TCP-IP详解卷1:协议 学习笔记(6) Ping
查看>>
Java核心技术 卷I 基础知识 学习笔记(4)
查看>>