我有一個數組列表。如何比較陣列列表與移動聯繫人
1)我的第一個ArrayList<String> some_num = new ArrayList<String>();
它包含這樣的值。
[1111111111, 2222222222]
現在我正試圖將此與我的移動聯繫人進行比較。
Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String[] projection = new String[] {ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER};
Cursor people = getActivity().getContentResolver().query(uri, projection, null, null, null);
int indexName = people.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
int indexNumber = people.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
int j_count=0;
String number;
people.moveToFirst();
do {
String name = people.getString(indexName);
number = people.getString(indexNumber);
j_count++;
// Do work...
} while (people.moveToNext());
for(int j=0;j<=j_count;j++){
if (some_num.contains(number)){
// do nothing
}
else{
Log.e("num",number);
}
}
我想從手機本書中得到那些不存在於我的ArrayList中的數字。我知道在條件我必須得到數組的價值,但是當我嘗試這樣做,我沒有得到我的聯繫的其餘部分。
在此先感謝
什麼是你面對這個代碼的問題,任何異常或任何錯誤? – Anjali
不,我只有一個單一的聯繫人 –