为了
public Intent (Context packageContext, Class <> cls)
如何设置类以访问内部类?通常我会这样做:
new Intent(this, NAMEOFCLASS.class)
这行得通吗?
new Intent(this, NAMEOFCLASS.class.INNERCLASS.class)
内部类是扩展广播接收器的类。我想创建一个挂起的意图,它将向内部类发送广播。
public class IntentServiceBroadcast extends IntentService {
private broadcastReceiver BroadcastReceiver = new broadcastReceiver();
private class broadcastReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
}
}
然后使用 alarmManager 发送一个 PendingIntent
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
new Intent(this, IntentServiceBroadcast.BroadcastReceiver.class), 0);
alarmManager.set(AlarmManager.RTC_WAKEUP, getTime()
.getTimeInMillis(), pendingIntent);
不确定上面的代码是否有效。