0
我想添加兩個數組列表爲一體,從而使其成爲一個和顯示..,在一個ArrayList中,從contactlist和其他IM retriving號IM名字檢索。通過combinig這兩個我想顯示他們在自動完成textview。 MainActivity如何將兩個數組列表融入其中,用自己的索引值
Cursor phones = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null,
null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
+ " ASC");
while (phones.moveToNext()) {
phoneNumber = phones
.getString(phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
name = phones
.getString(phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
System.out.println(phoneNumber);
name1.add(name);
phno1.add(phoneNumber);
// meMap.put("name1","phno1");
// mPeopleList.add(name);
// mPeopleList.add(phoneNumber);
ArrayList<HashMap<String, String>> inviteList = new ArrayList<HashMap<String, String>>();
for(int i=0;i < name1.size();i++)
{
HashMap map = new HashMap<String, String>();
map.put(name1.get(i).toString());
map.put("emailID", inviteListRespone.get(i).getEmail());
inviteList.add(map);
}
}
searchText = (AutoCompleteTextView) findViewById(R.id.autocomplete);
//String[] from={ Phone.DISPLAY_NAME, phoneNumber};
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line,name1);
lv = (ListView) findViewById(R.id.lv);
ma = new MyAdapter();
searchText.setThreshold(1);
searchText.setAdapter(adapter);
非常感謝你@Daniel博 – Himani