开发者

Progress Dialogs with Sound in Android

I have searched around for possible answers, but did not find one that came close to what I require.

I am after creating a progress dialog in Android, the standard one with the spinning disk. However, what I want is for the dialog to play a loop开发者_如何转开发ed sound sample as it spins which stops when its dismissed.

How would you go about doing this?

All the best

Andrew.


When you first show() your ProgressDialog start a looping MediaPlayer.

    MediaPlayer mAlarmPlayer=MediaPlayer.create(this, R.raw.alarm_1);
    mAlarmPlayer.setLooping(true);
    mAlarmPlayer.start();

when you will dismiss() your ProgressDialog just call:

    mAlarmPlayer.stop();
    mAlarmPlayer.release();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜