This is my script:
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
this.setContentView(R.layout.main);
Button myButton = (Button)this.findViewById(R.id.my_button);
myButton.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
MediaPlayer mp =
MediaPlayer.create(MainActivity.this,
R.raw.xd);
mp.start();
// i.e. react on the end of the music-file:
mp.setOnCompletionListener(new
OnCompletionListener(){
// @Override
public void onCompletion(MediaPlayer arg0) {
// File has ended !!! Wink
}
});
}
});
}
}
but when I click the button in my app the application crashes. Why
does this happen?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en