本文整理匯總了Java中android.widget.ListView.isItemChecked方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.isItemChecked方法的具體用法?Java ListView.isItemChecked怎麽用?Java ListView.isItemChecked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ListView
的用法示例。
在下文中一共展示了ListView.isItemChecked方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionModeDialpad
import android.widget.ListView; //導入方法依賴的package包/類
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();
}
示例2: actionModeDelete
import android.widget.ListView; //導入方法依賴的package包/類
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();
}
}
示例3: getSelectedSongs
import android.widget.ListView; //導入方法依賴的package包/類
private static List<MusicDirectory.Entry> getSelectedSongs(ListView albumListView)
{
List<MusicDirectory.Entry> songs = new ArrayList<MusicDirectory.Entry>(10);
if (albumListView != null)
{
int count = albumListView.getCount();
for (int i = 0; i < count; i++)
{
if (albumListView.isItemChecked(i))
{
songs.add((MusicDirectory.Entry) albumListView.getItemAtPosition(i));
}
}
}
return songs;
}
示例4: onPrepareActionMode
import android.widget.ListView; //導入方法依賴的package包/類
@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;
}