将联系人添加到列表视图?
我有一个 ListView 和一个联系人选择器。我想要做的是,当我选择一个联系人时,我希望该联系人显示在列表视图中并保存在该列表视图中。到目前为止,我已经有了
ListView emailEntry = (ListView) findViewById(R.id.list);
emailEntry.setFilterText(Number);
if (Number.length() == 0) {
Toast.makeText(this, "No number found for contact.",
Toast.LENGTH_LONG).show();
}
This is Java 文本,其中数字被调用到列表视图中,
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/list"
/>
这显然是我的.XML 文件。
我没有强制关闭。问题是联系人没有被调入列表视图
I have a ListView and I have a contact picker. What I want to do is when I pick a contact I want the contact to show up in a list view and be saved in that list view. so far I have
ListView emailEntry = (ListView) findViewById(R.id.list);
emailEntry.setFilterText(Number);
if (Number.length() == 0) {
Toast.makeText(this, "No number found for contact.",
Toast.LENGTH_LONG).show();
}
This is the Java text were the number gets called into the list view
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/list"
/>
this is obviously my .XML file.
I get no force closing. the problem is the contact doesn't get called into the list view
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能否提供有关您正在尝试做什么的更多信息?您的数据源是什么?
我从来没有使用过ListView。结果,我可能没有抓住要点,但这是我的两分钱。
基于我的粗浅假设,为什么不使用 ListActivity 和自定义 (List)Adapter 来显示数据?然后你可以实现 onListItemClick() 并使用 startActivity() (具有正确的意图)或触发祝酒或任何有用的东西。我的观点是,您的问题是一个以数据为中心的问题,而不是以视图为中心的问题。
此致,
雷诺
Could you provide more information about what you are trying to do? What is your data source?
I have never used ListView. As a consequence, I probably missed the point but here is my two cents.
Based on my humble assumptions, why don't you use a ListActivity and a custom (List)Adapter to display your data? Then you could implement onListItemClick() and use startActivity() (with the proper intent) or fire a toast or whatever is usefull. My opinion is that your problem is a data-centric problem, not a view-centric one.
Best Regards,
Renaud