到下一个警报的时间(以秒或毫秒为单位)
使用此代码,我可以获取一些字符串,例如“Wed 10:10”,
String nextAlarm = Settings.System.getString(getContentResolver(),
Settings.System.NEXT_ALARM_FORMATTED);
但我希望获得距离下一个警报的秒数值。这可能吗? 另外,如果我能够读取描述字段的值以及启用此警报的日期,那对我来说会很好。
With this code I am able to take some string like "Wed 10:10",
String nextAlarm = Settings.System.getString(getContentResolver(),
Settings.System.NEXT_ALARM_FORMATTED);
but I want to have a value of seconds to the next alarm. Is that possible ?
Also it would be nice for me if I am able to read the value of the description field, and the days when this alarm is enabled.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要通过以下方式来完成:
long millis = AlarmFulldate.getTime() - new Date().getTime();
变量 millis 将具有毫秒。
使用以下代码从 millis 获取天数、小时数和分钟数
希望这对您有帮助
You need to do it by following way
long millis = AlarmFulldate.getTime() - new Date().getTime();
Variable millis will have milliseconds.
Use following code to get days, hours and min from millis
Hope this will help you