我有连接到数据库的列表视图。
当我选择行时,我得到相同的 ID。
public void onListItemClick(ListView parent, View v, int position,long id) {
showDialog(DELETE_ROW);
}
else if (id==2)
{
builder.setMessage(c.getString(0)); <-- here i get error id - same id all the time
builder.setTitle("AAA");
builder.setIcon(R.drawable.no);
builder.setCancelable(false);
builder.setPositiveButton("yes ", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
Toast.makeText(getBaseContext(),c.getString(0),Toast.LENGTH_SHORT).show(); <-- here i get the real id - what i need
}
});
builder.setNegativeButton("no", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
return;
}
});
}
可能是什么问题?