本文整理汇总了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;
}