I am trying to build the alarmclock source code after copy pasting in my files While compilation, I get the error, mContext cannot be resolved. Here is the link to this piece of code: http://www.netmite.com/android/mydroid/2.0/packages/apps/AlarmClock/src/com/android/alarmclock/DigitalClock.java
And I have copy pasted some part of the code which uses mContext below
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (Log.LOGV) Log.v("onAttachedToWindow " + this);
if (mAttached) return;
mAttached = true;
if (mAnimate) {
setBackgroundResource(R.drawable.animate_circle);
/* Start the animation (looped playback by default). */
((AnimationDrawable) getBackground()).start();
}
if (mLive) {
/* monitor time ticks, time changed, timezone */
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_TIME_TICK);
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
}
/* monitor 12/24-hour display preference */
mFormatChangeObserver = new FormatChangeObserver();
mContext.getContentResolver().registerContentObserver(
Settings.System.CONTENT_URI, true, mFormatChangeObserver);
updateTime();
}
private void setDateFormat() {
mFormat = Alarms.get24HourMode(mContext) ? Alarms.M24 : M12;
mAmPm.setShowAmPm(mFormat == M12);
}
To solve this compilation error, I put this statement in my code
Context mContext;
But though the compilation errors are solved, on launch in the emulator, the application throws an exception and exits without launching.
Can some one please tell me how to use this context thing or wat shud i write as an alternative?