Foe*_*nix 0 android click android-listview simplecursoradapter
我有一个ListView,SimpleCursorAdapter我想知道如何获得ListView一个身份证的位置?我需要它来执行单击列表中的特定行,如下所示
lv.performItemClick(lv, pos, lv.getItemIdAtPosition(pos));
Run Code Online (Sandbox Code Playgroud)
迭代你Cursor使用的SimpleCursorAdapter并检查id:
if (cursor.moveToFirst()) {
while (!cursor.isAfterLast) {
if (cursor.getLong(/*the index of the _id column*/) == theTargetId) {
theWantedPosition = cursor.getPosition();
break;
}
cursor.moveToNext();
}
}
lv.performItemClick(lv, theWantedPosition, lv.getItemIdAtPosition(theWantedPosition));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1159 次 |
| 最近记录: |