i’am doing a small app in android.And in gridviewitemclicklistner it returns id=0 everytime please help me?
g2.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View v,
int position, long id)
{
Toast.makeText(MainActivity.this,''+id,Toast.LENGTH_SHORT).show();
}
Try using the
position-variable instead. The fact thatidreturns 0 simply means that the clicked row doesn’t have an id. (Which it probably doesn’t in your case. So I don’t think there is a real problem here.)