How Can I Use Button To Play A Sound With Listview?
I want to add a button in ListView to play sound. The problem is the IDE (in List.java) cannot resolve this method mediaPlayer.create(this,R.raw.people); The MainActivity.java code
The method signature is MediaPlayer create (Context context, int resid)
View.OnClickListener
is not a Context
, which is what this
is in that case. BaseAdapter
is also not a Context
.
You can declare it in the adapter using MediaPlayer.create(List.this.context, R.raw.people)
Post a Comment for "How Can I Use Button To Play A Sound With Listview?"