Skip to content Skip to sidebar Skip to footer

Alarm Clock From Git - Gives Error - Android

I downloaded the alarm clock example from the below link: https://github.com/android/platform_packages_apps_alarmclock I fixed most of the except the following: Alarms.java: Line

Solution 1:

What you downloaded isn't really an 'example', but rather the source of a system application. As such, it has access to certain parts of the SDK that you can't normally access yourself, because the app gets built directly against the source code of Android.

If you look at the Intent source code, you'll find the following snippet:

/**
 * Alarm Changed Action: This is broadcast when the AlarmClock
 * application's alarm is set or unset.  It is used by the
 * AlarmClock application and the StatusBar service.
 * @hide
 */@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_ALARM_CHANGED="android.intent.action.ALARM_CHANGED";

Note the @hide annotation at the last line of the Javadoc. This indicates that the constant is not part of the public Android SDK. The part of the build process that creates the Android SDK will not include this member in the stub edition of android.content.Intent that is in the android.jar file that you are compiling against.

The @hide annotation is used for things that for internal purposes needed to be public or protected but are not considered something SDK developers should be using.

Also refer to @CommonWare's answer on this matter, or Romain Guy's over at Google Groups.

In short: you can't use that constant. You could try replacing it with its string value ("android.intent.action.ALARM_CHANGED"), but remember that there's probably a good reason for it not being available to developers. Knowing that, you should really not be attempting to use it at all.

Solution 2:

I think that maybe it's a problem of the imports. Try checking the imports of your class. Sometimes Eclipse imports the R.java class from the android package and stop using yours. Remove imports like import android.R

Post a Comment for "Alarm Clock From Git - Gives Error - Android"