[英]I have an issue displaying the user's current location on Google Maps in my Android app. Can anyone tell me what I need to do with my code
[英]I cannot bind the contacts in my arraylist can anyone tell me what i do wrong?ANDROID
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
null, null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
c_Name.add(name);
} }
name_Val = (String[]) c_Name.toArray(new String[c_Name.size()]);
//phone_Val= (String[]) c_Number.toArray(new String[c_Name.size()]);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,name_Val);
txtPhoneName.setAdapter(adapter);
為什么綁定到ArrayList? 您可以使用SimpleCursorAdapter直接綁定到cur。
什么是autocompletetextView?
很難確定到底發生了什么,因為缺少了很多應用程序。
另外,您到底想做什么? 可能有一種更簡單的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.