I wanted each item of ListView
to play a song by clicking the button for each item, but when I click the button, it even plays, only the first song, the other songs in the list do not play.
I used a% custom% in the main activity and my listview
looks like this:
public class Adapter extends ArrayAdapter<Itens>{
private MediaPlayer mMedia;
(...)
final Button playButton = (Button)layout.findViewById(R.id.start);
if (item.hasAudio()){
playButton.setOnClickListener(new View.OnClickListener(){
@Override
públic void onClick (View v){
mMedia = MediaPlayer.create(getContext(),item.getAudio());
mMedia.start();
mMedia.onCompletionListener = (...)}
return Layout;}