如果值为null或为空,如何使listView可以在一个列表中单击,而不能在其他列表中单击
ListView lv = getListView();
if (TAG_UID.isEmpty() && TAG_UID == null)
{
lv.setEnabled(false);
}
else
{
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
Intent in = new Intent(AllProductsActivity.this,
MyActivity2.class);
startActivity(in);
}
});
从mysql数据库获取值,感谢您的帮助
答案 0 :(得分:0)
对于您想要的位置,使用return
语句
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if(position==2){
return;
}else{
//put your code here
}
}