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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:11:41+00:00 2026-05-31T06:11:41+00:00

I have seen a lot of tutorials and been trying for 2 hours now

  • 0

I have seen a lot of tutorials and been trying for 2 hours now , though something is still wrong. I am very nervous now 🙂 I want to set an alarm e.g. to 16:25 to go off, but nothing happens. I have this code:

   Calendar cur_cal = new GregorianCalendar();
    cur_cal.setTimeInMillis(System.currentTimeMillis());

    Calendar cal = new GregorianCalendar();
    cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR));
    cal.set(Calendar.HOUR_OF_DAY, 16);
    cal.set(Calendar.MINUTE, 25);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);

    alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);

I have also tried this:

 cal.set(Calendar.AM_PM, cur_cal.get(Calendar.AM_PM));
    cal.set(Calendar.HOUR, 4);

My final goal is to make it a repeating alarm, e.g. it should go off every day at the set time.

Update 01.17.2011. Still not working. I have this code:

           Calendar cal = Calendar.getInstance();
            cal.set(Calendar.YEAR, 2011);
            cal.set(Calendar.MONTH, Calendar.JANUARY); 
            cal.set(Calendar.DAY_OF_MONTH, 17);
            cal.set(Calendar.HOUR_OF_DAY, 16);
            cal.set(Calendar.MINUTE, 58);
         cal.set(Calendar.SECOND, 0);
          cal.set(Calendar.MILLISECOND, 0);

I have also tried this:

 cal.set(Calendar.HOUR, 4);
 cal.set(Calendar.AM_PM, Calendar.PM);

and this:

cal.set(Calendar.HOUR_OF_DAY, 4 );
            cal.set(Calendar.AM_PM, Calendar.PM);
  • 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-05-31T06:11:42+00:00Added an answer on May 31, 2026 at 6:11 am
    package your.pack.name;
    
    import java.util.Calendar;
    
    import android.app.Activity;
    import android.app.AlarmManager;
    import android.app.PendingIntent;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    
    public class AlarmActivity extends Activity {
        /** Called when the activity is first created. */
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            Calendar cal = Calendar.getInstance();
    
            cal.setTimeInMillis(System.currentTimeMillis());
            cal.clear();
            cal.set(2012,2,8,18,16);
    
            AlarmManager alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
            Intent intent = new Intent(this, AlarmReceiver.class);
            PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
           // cal.add(Calendar.SECOND, 5);
            alarmMgr.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
    
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question seems to have been asked a lot, but I haven't seen an
I'm new to ASP.NET, but I've seen a lot of tutorials and even have
I have seen a lot of tutorials and articles showing how to generate barcode
About deploying a Node.js application, I have seen a lot of tutorials showing it
I have seen a lot of form validation tutorials with jquery ajax. I found
I have seen lot projects following this kind of coding style Any significant advantage
I have seen a lot of people in the C++ community(particularly ##c++ on freenode)
I have seen a lot of software that show that which registry has error.
I have seen a lot of old articles on SO. So i am asking
i have seen a lot of screencasts where the author is creating methods with

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.