开发者

Adding contacts to list view?

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.",  
                 开发者_C百科             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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜