4
I have a screen that has a ListView
inside it, I need to identify which line was clicked to direct to the correct location. How can I do this?
4
I have a screen that has a ListView
inside it, I need to identify which line was clicked to direct to the correct location. How can I do this?
5
You can use the method setOnItemClickListener()
in 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 it results in a message Toast
onscreen:
Good luck.
Browser other questions tagged java android listview
You are not signed in. Login or sign up in order to post.
I can make an IF inside the setOnItemClickListener?
– carlos giovani casilo
@carlosgiovanicasilo yes, always.
– viana
Thank you so much for your help.
– carlos giovani casilo