/* * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) * 版权信息,指出这段代码由MiCode开源社区在2010-2011年间创作。 */ /* * Licensed under the Apache License, Version 2.0 (the "License"); * 这段代码遵循Apache License 2.0版本授权。 */ /* * you may not use this file except in compliance with the License. * 你只能遵守这个License来使用这个文件。 */ /* * You may obtain a copy of the License at * 你可以在以下地址获取这个License的副本: */ http://www.apache.org/licenses/LICENSE-2.0 /* * Unless required by applicable law or agreed to in writing, software * 除非遵循相关法律或者书面同意,否则 */ /* * distributed under the License is distributed on an "AS IS" BASIS, * 在这个License下发布的软件是在“现状”基础上发布的, */ /* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 不附带任何形式的明示或暗示的担保或条件。 */ /* * See the License for the specific language governing permissions and * 请查看这个License以了解关于权限和 */ /* * limitations under the License. * 这个License下的限制条件。 */ package net.micode.notes.ui; // 声明这个类所在的包名。 import android.content.BroadcastReceiver; // 导入Android的BroadcastReceiver类,用于接收广播消息。 import android.content.Context; // 导入Android的Context类,表示应用环境的信息。 import android.content.Intent; // 导入Android的Intent类,用于不同组件之间的通信。 public class AlarmReceiver extends BroadcastReceiver { // 声明一个名为AlarmReceiver的类,它继承自BroadcastReceiver。 @Override public void onReceive(Context context, Intent intent) { // 重写onReceive方法,当接收到广播时调用,接收两个参数:Context和Intent。 intent.setClass(context, AlarmAlertActivity.class); // 设置Intent的目标Activity为AlarmAlertActivity。 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 为Intent添加标志,表示这个Activity将作为一个新的任务启动。 context.startActivity(intent); // 使用Context启动Intent指定的Activity。 } }