I have a screen that has ListView
inside it, I need to identify which line was clicked to point to the correct location. How can I do this?
I have a screen that has ListView
inside it, I need to identify which line was clicked to point to the correct location. How can I do this?
You can use the setOnItemClickListener()
this way:
listItemView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, listItemsValue[position], Toast.LENGTH_SHORT).show();
}
});
In my case this results in a Toast
message on the screen:
Good luck.