如何在特定时间播放声音? [英] how to play sound in specific times?

查看:94
本文介绍了如何在特定时间播放声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  

您好,我有Android应用程序从而起到声音,当值的我做我的code好,效果不错。   我需要做的列表或数组或任何与特定的日子   次为:

     

1013年7月7日

     

下午3点半,上午01点20,上午03点半....等。

因为当一天2013年7月7日和点钟上午01时20播放声音。如何做到这一点?

  @JavascriptInterface
公共无效playsound(字符串值){

    如果(value.equals(上)){
        检查=真;

        mp.setLooping(真正的);
        mp.start();
    }
    其他
    {
        检查=虚假的;
        mp.stop();
    }
}
 

解决方案

使用AlarmManager来为时间报警。当报警到来时,播放声音。

hi i had android app which play sound when value on i did my code well and it worked well . I need to make as list or array or whatever have specific days with times as :

day 07.07.1013

times 3.30pm , 1.20am ,3.30am ....etc.

as when the day 07.07.2013 and the o'clock 1.20am the sound play . how to do that ?

 @JavascriptInterface
public void playsound(String value  ) {

    if (value.equals("on")){
        checked = true;

        mp.setLooping(true);
        mp.start();
    }
    else 
    {  
        checked = false;
        mp.stop();
    }
}

解决方案

Use AlarmManager to set an alarm for that time. When the alarm comes in, play the sound.

这篇关于如何在特定时间播放声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆