Programming Language · 2017-12-11 0

How do i reference a songs index position when calling onClick


This is what I want to achieve but in a single text view not the whole list

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    public void onItemClick(AdapterView<?> adapterView, View view, int 
    position, long l) {
        // Release the media player if it currently exists because we are about to
        // play a different sound file

        // Get the {@link Word} object at the given position the user clicked on
        Word word = words.get(position);

When I chose onClick I cannot reference the array-list sound resource id.

However on OnItemClick, there is a argument passed in called position that gets the position, however, I don’t want to click the whole list item box just the textview to play the sound.

What do I do similar to the Word word = words.get(position)

But in a onClick Method for a single textview? Any help appreciated.



Would love your thoughts, please comment.x