I can play a sound in my activity. e.g.:
public class APP extends Activity {
MediaPlayer btnClick;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnClick = MediaPlayer.create(this, R.raw.button_click);
}
... on Button Click play sound ...
btnClick.start();
...
}
But I have no idea how to play a sound in a class file?
public class test {
...
}
Is that not possible? I tried so many variations. In the class file, I can't play a sound.