我不能在方法中使用myid[]
整数列表。onclick
我是说 :
我想从的光标列表中获取myid[0]
, myid[1]
, myid[2]
...... 列表值populatelist()
然后我就可以onClick
像这样的方法使用它们myid[index]
@Override
protected void populateList() {
Cursor cursorKayit = db.rawQuery(query, null);
int[] myid = new int[cursorKayit.getCount()];
int i = 0;
while(cursorKayit.moveToNext()){
myid[i]=cursorKayit.getInt(0);
String mytitle=cursorKayit.getString(1);
String mydescription=cursorKayit.getString(2);
getUITableView().addBasicItem(mytitle, mydescription);
i++;
}
cursorKayit.close();
}
..
private class CustomClickListener implements ClickListener {
@Override
public void onClick(int index) {
Toast.makeText(CategoryMenu.this, "item clicked: " + myid[index], Toast.LENGTH_SHORT).show();
}
}