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 7851969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:18:30+00:00 2026-06-02T19:18:30+00:00

I am using Calendar class to obtain the current date and time. Then I

  • 0

I am using Calendar class to obtain the current date and time. Then I set the date and time for the alarm and the information is passed to AlarmManager object. I have a button “Set Alarm” clicking on it should set the alarm, Somehow clicking the button gives no feedback.

          Button btnOpen = (Button) findViewById(R.id.btnSetAlarm);
          btnOpen.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {                
            timePicker = (TimePicker) findViewById(R.id.timePicker);
            datePicker = (DatePicker) findViewById(R.id.datePicker);                   

            AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);                 


            Calendar calendar = Calendar.getInstance();       

            calendar.set(Calendar.YEAR, datePicker.getYear());
            calendar.set(Calendar.MONTH, datePicker.getMonth());
            calendar.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth());                 
            calendar.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour());
            calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute());
            calendar.set(Calendar.SECOND, 0);


        PendingIntent displayIntent = PendingIntent.getActivity(
            getBaseContext(), 0, 
            new Intent("my.todo.list.ShowNotification"), 0);               

         alarmManager.set(AlarmManager.RTC_WAKEUP, 
            calendar.getTimeInMillis(), displayIntent);
      }
      }); 
      }

I am using Android version 4.0.1

Thanks.

  • 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-02T19:18:31+00:00Added an answer on June 2, 2026 at 7:18 pm

    First, clicking the button is not supposed to give you any feedback. You did not include any code to give you any feedback. All you did was set an alarm for some particular time.

    Second, don’t use getBaseContext() unless you have some specific reason to do so, and you do not have such a reason here. Use this.

    Third, unless you have an activity with an <intent-filter> that has an <action> of my.todo.list.ShowNotification, nothing will happen when the alarm time comes, other than a warning or error being dumped into LogCat.

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

Sidebar

Related Questions

How can I display the time in the current app locale using Calendar? For
I have a class that extends Calendar for supporting Jalali calendar. Currently I'm using
I'm using jcal2 calendar for choosing date from calender. It working when i'm using
I have a datefilter for datatables using a calendar image and it works great.
I am trying to create a calendar using the Gallery widget. I have a
Issue/Question : I'm using CodeIgniter to build an event calendar, and I have included
I'm using the CodeIgniter calendar class to generate an availability calendar. I use a
I'm using calendar_helper with success using this code: <%= calendar({:year => Date.today.year, :month =>
I have following code to get different parts of current system Date (10-11-2011 for
I have designed a custom calendar using html and jQuery. I want to highlight

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.