fork download
  1. package com.example.alarm;
  2.  
  3. import android.content.BroadcastReceiver;
  4. import android.content.Context;
  5. import android.content.Intent;
  6.  
  7. public class AlarmReceiver extends BroadcastReceiver {
  8. @Override
  9. public void onReceive(Context context, Intent intent) {
  10. String keyword1 = intent.getStringExtra("hogeID");
  11.  
  12. Intent newIntent = new Intent();
  13. newIntent.setAction("com.example.action.ALARM");
  14. newIntent.putExtra("hogeID", keyword1);
  15. context.sendBroadcast(newIntent);
  16. }
  17. }
  18.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: error: class AlarmReceiver is public, should be declared in a file named AlarmReceiver.java
public class AlarmReceiver extends BroadcastReceiver {
       ^
Main.java:3: error: package android.content does not exist
import android.content.BroadcastReceiver;
                      ^
Main.java:4: error: package android.content does not exist
import android.content.Context;
                      ^
Main.java:5: error: package android.content does not exist
import android.content.Intent;
                      ^
Main.java:7: error: cannot find symbol
public class AlarmReceiver extends BroadcastReceiver {
                                   ^
  symbol: class BroadcastReceiver
Main.java:9: error: cannot find symbol
	public void onReceive(Context context, Intent intent) {
	                      ^
  symbol:   class Context
  location: class AlarmReceiver
Main.java:9: error: cannot find symbol
	public void onReceive(Context context, Intent intent) {
	                                       ^
  symbol:   class Intent
  location: class AlarmReceiver
Main.java:12: error: cannot find symbol
		Intent newIntent = new Intent();
		^
  symbol:   class Intent
  location: class AlarmReceiver
Main.java:12: error: cannot find symbol
		Intent newIntent = new Intent();
		                       ^
  symbol:   class Intent
  location: class AlarmReceiver
Main.java:8: error: method does not override or implement a method from a supertype
	@Override
	^
10 errors
stdout
Standard output is empty