Java Code Examples for android.widget.listview#isItemChecked()
The following examples show how to use
android.widget.listview#isItemChecked() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CallLogListFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
private void actionModeDelete() { ListView lv = getListView(); ArrayList<Long> checkedIds = new ArrayList<Long>(); for(int i = 0; i < lv.getCount(); i++) { if(lv.isItemChecked(i)) { long[] selectedIds = mAdapter.getCallIdsAtPosition(i); for(long id : selectedIds) { checkedIds.add(id); } } } if(checkedIds.size() > 0) { String strCheckedIds = TextUtils.join(", ", checkedIds); Log.d(THIS_FILE, "Checked positions ("+ strCheckedIds +")"); getActivity().getContentResolver().delete(SipManager.CALLLOG_URI, Calls._ID + " IN ("+strCheckedIds+")", null); mMode.finish(); } }
Example 2
Source File: CallLogListFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
private void actionModeDialpad() { ListView lv = getListView(); for(int i = 0; i < lv.getCount(); i++) { if(lv.isItemChecked(i)) { mAdapter.getItem(i); String number = mAdapter.getCallRemoteAtPostion(i); if(!TextUtils.isEmpty(number)) { Intent it = new Intent(Intent.ACTION_DIAL); it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_SIP, number)); startActivity(it); } break; } } mMode.invalidate(); }
Example 3
Source File: AppEditActivity.java From smartcard-reader with GNU General Public License v3.0 | 6 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ListView list = (ListView) parent; int lastIndex = mGrpItems.size() - 1; if (list.isItemChecked(lastIndex)) { list.setItemChecked(lastIndex, false); createNewGroup(); return; } boolean checked = list.isItemChecked(position); mGrpItems.get(position).setChecked(checked); String name = mGrpItems.get(position).toString(); if (checked) { mAppGroups.add(name); } else { mAppGroups.remove(name); } updateGrpButton(); }
Example 4
Source File: CallLogListFragment.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { Log.d(THIS_FILE, "onPrepareActionMode"); ListView lv = getListView(); int nbrCheckedItem = 0; for (int i = 0; i < lv.getCount(); i++) { if (lv.isItemChecked(i)) { nbrCheckedItem++; } } menu.findItem(R.id.delete).setVisible(nbrCheckedItem > 0); menu.findItem(R.id.dialpad).setVisible(nbrCheckedItem == 1); return false; }