Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:14:50+00:00 2026-06-09T07:14:50+00:00

Hello i have the problem. LogCat giving me some errors. LogCat: 08-05 11:42:30.222: E/AndroidRuntime(623):

  • 0

Hello i have the problem.

LogCat giving me some errors.

LogCat:

08-05 11:42:30.222: E/AndroidRuntime(623): FATAL EXCEPTION: main
08-05 11:42:30.222: E/AndroidRuntime(623): java.lang.NullPointerException
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.text.format.DateFormat.is24HourFormat(DateFormat.java:204)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.Alarms.get24HourMode(Alarms.java:536)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.DigitalClock.setDateFormat(DigitalClock.java:192)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.DigitalClock.onFinishInflate(DigitalClock.java:121)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:631)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.AlarmClock$AlarmTimeAdapter.newView(AlarmClock.java:96)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.CursorAdapter.getView(CursorAdapter.java:182)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.AbsListView.obtainView(AbsListView.java:1430)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.ListView.measureHeightOfChildren(ListView.java:1216)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.ListView.onMeasure(ListView.java:1127)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.View.measure(View.java:8313)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.View.measure(View.java:8313)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.View.measure(View.java:8313)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.View.measure(View.java:8313)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.View.measure(View.java:8313)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.os.Looper.loop(Looper.java:123)
08-05 11:42:30.222: E/AndroidRuntime(623):  at android.app.ActivityThread.main(ActivityThread.java:3683)
08-05 11:42:30.222: E/AndroidRuntime(623):  at java.lang.reflect.Method.invokeNative(Native Method)
08-05 11:42:30.222: E/AndroidRuntime(623):  at java.lang.reflect.Method.invoke(Method.java:507)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-05 11:42:30.222: E/AndroidRuntime(623):  at dalvik.system.NativeStart.main(Native Method)

A bit of code ( where there are errors )

LogCat:

08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.Alarms.get24HourMode(Alarms.java:536)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.DigitalClock.setDateFormat(DigitalClock.java:192)
08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.DigitalClock.onFinishInflate(DigitalClock.java:121)

Code:

static Calendar calculateAlarm(int hour, int minute, Alarm.DaysOfWeek daysOfWeek) {

    // start with now
Calendar c = Calendar.getInstance();
c.setTimeInMillis(System.currentTimeMillis());

int nowHour = c.get(Calendar.HOUR_OF_DAY);
int nowMinute = c.get(Calendar.MINUTE);

// if alarm is behind current time, advance one day
if (hour < nowHour  ||
    hour == nowHour && minute <= nowMinute) {
    c.add(Calendar.DAY_OF_YEAR, 1);
}
c.set(Calendar.HOUR_OF_DAY, hour);
c.set(Calendar.MINUTE, minute);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);

int addDays = daysOfWeek.getNextAlarm(c);
/* Log.v("** TIMES * " + c.getTimeInMillis() + " hour " + hour +
   " minute " + minute + " dow " + c.get(Calendar.DAY_OF_WEEK) + " from now " +
   addDays); */
if (addDays > 0) c.add(Calendar.DAY_OF_WEEK, addDays);
    return c;
}

static String formatTime(final Context context, int hour, int minute,
                         Alarm.DaysOfWeek daysOfWeek) {
    Calendar c = calculateAlarm(hour, minute, daysOfWeek);
    return formatTime(context, c);
}

/* used by AlarmAlert */
static String formatTime(final Context context, Calendar c) {
    String format = get24HourMode(context) ? M24 : M12;
    return (c == null) ? "" : (String)DateFormat.format(format, c);
}

/**
 * Shows day and time -- used for lock screen
 */
private static String formatDayAndTime(final Context context, Calendar c) {
    String format = get24HourMode(context) ? DM24 : DM12;
    return (c == null) ? "" : (String)DateFormat.format(format, c);
}

/**
 * Save time of the next alarm, as a formatted string, into the system
 * settings so those who care can make use of it.
 */
static void saveNextAlarm(final Context context, String timeString) {
    Settings.System.putString(context.getContentResolver(),
                              Settings.System.NEXT_ALARM_FORMATTED,
                              timeString);
}

/**
 * @return true if clock is set to 24-hour mode
 */
static boolean get24HourMode(final Context context) {
    return android.text.format.DateFormat.is24HourFormat(context);
}

Next:

LogCat:

08-05 11:42:30.222: E/AndroidRuntime(623):  at com.android.alarmclock.AlarmClock$AlarmTimeAdapter.newView(AlarmClock.java:96)

Code:

public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View ret = mFactory.inflate(R.layout.alarm_time, parent, false);

    ((TextView) ret.findViewById(R.id.am)).setText(mAm);
    ((TextView) ret.findViewById(R.id.pm)).setText(mPm);

    DigitalClock digitalClock =
            (DigitalClock) ret.findViewById(R.id.digitalClock);
    digitalClock.setLive(false);
    return ret;
}

Project: https://github.com/android/platform_packages_apps_alarmclock Apache 2.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:14:54+00:00Added an answer on June 9, 2026 at 7:14 am

    mContext in the DigitalClock.java class is null. you must set it a context.
    add this in your class :

    mContext=context;
    

    About second problem. you must paste complete log. what is the problem?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have a problem with trimming string in c++. It adds some weird
Hello I am a Java web app developer I have a problem, I would
Hello guys I have a problem with my application involving Lucene java library and
Hello everyone i have a problem I have a text $text = some and
Hello everybody I have a problem with exception. The following code block do this
Hello I have a main app that is going to have some plugins in
Hello i have problem with my sms aplication. import java.util.ArrayList; import java.util.List; import android.app.Activity;
hello everyone I have some problem with understanding this piece of the code: import
Hello everyone I have some problem to grab movie title with regular expression. how
Hello I have a Problem with some Buttons I would like to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.