Code example for SparseBooleanArray

Methods: keyAtsizevalueAt

0
		ArrayAdapter<SMSGroupEntryContactsItem> listAdapter = (ArrayAdapter<SMSGroupEntryContactsItem>)getListAdapter();
		if (listAdapter != null) {
			if (Build.VERSION.SDK_INT > 10) {
				SparseBooleanArray checkedItemPositions = mListView.getCheckedItemPositions();
				long[] checkedItemIds = new long[mListView.getCheckedItemCount()];
				int size = checkedItemPositions.size();
				for (int idx = 0, j = -1; idx < size; ++idx) {
					if (checkedItemPositions.valueAt(idx)) {
						int pos = checkedItemPositions.keyAt(idx);
						checkedItemIds[++j] = listAdapter.getItem(pos).getDbId();
					} 
				} 
				mDataManager.deleteSMSContacts(checkedItemIds);
			} else { 
				long[] checkItemIds1 = mListView.getCheckItemIds();
				long[] checkedItemIds = new long[checkItemIds1.length];
				for (int idx = checkItemIds1.length - 1; idx >= 0; --idx) {
					checkedItemIds[idx] = listAdapter.getItem((int)checkItemIds1[idx]).getDbId();
				} 
				mDataManager.deleteSMSContacts(checkedItemIds);
Connect your IDE to all the code out there  Get Codota for Java