博客
关于我
强烈建议你试试无所不能的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://xrbai.baihongyu.com/

你可能感兴趣的文章
poj 2553 The Bottom of a Graph 未完
查看>>
inux下如何统计一个目录下的文件个数以及代码总行数(转)
查看>>
Linux下 虚拟机Bochs的使用
查看>>
glib-读取配置文件
查看>>
SonarQube 静态代码检查的安装
查看>>
嵌入式Linux驱动开发的知识图谱
查看>>
Algorithm 4th environment setup
查看>>
Linux设备驱动开发基础之互斥与同步基础
查看>>
Linux驱动开发之内存管理基础
查看>>
用gitlabCI快速搭建一个GitServer与CI
查看>>
SPI Nor Flash
查看>>
ARM Linux BenchMark
查看>>
完整精确导入Kernel与Uboot参与编译了的代码到Source Insight,Understand, SlickEdit
查看>>
Freescale IMX6 Android (5): APP通过JNI控制LED
查看>>
PPT分享: Linux启动流程 关于initrd与initramfs的区分及其发展历程
查看>>
Freescale IMX6 Android (7): Android启动动画死循环 Home界面不出来与pid XXX exit 可能的原因汇总
查看>>
Yocto i.MX6 (TQIMX6) (01) : 3.14.28内核的适配
查看>>
Yocto tips (6): Yocto中如何共享已经下载的文件
查看>>
Yocto tips (1): Yocto 编译后文件放在了哪里 输出文件位置
查看>>
Yocto tips (2): Yocto Linux内核编译目录在哪?
查看>>