Android 每隔一分钟发出时间更新广播
Android BroadcastReceiver About 450 words方法
每隔一分钟时间改变了就会发送该广播
Intent.ACTION_TIME_TICK
- 动态注册广播
IntentFilter filter=new IntentFilter();
filter.addAction(Intent.ACTION_TIME_TICK);
registerReceiver(receiver,filter);
- 接收广播
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Intent.ACTION_TIME_TICK)) {
//刷新UI
}
}
};
Views: 5,705 · Posted: 2019-04-09
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...