]> iEval git - unical.git/commitdiff
Add function to add alarm
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Tue, 18 Jun 2013 13:38:03 +0000 (16:38 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Tue, 18 Jun 2013 13:38:03 +0000 (16:38 +0300)
res/menu/event_list.xml
src/ro/ieval/unical/AlarmActivity.java [deleted file]
src/ro/ieval/unical/EventListActivity.java
src/ro/ieval/unical/Utils.java

index 8d1346e873b4eb5abf4c2c8b4735f5ceb16493a2..6a137362dacf386d326b0ffefaea6bc90596c51b 100644 (file)
@@ -10,5 +10,4 @@
         android:icon="@android:drawable/ic_popup_sync"
         android:showAsAction="ifRoom"></item>
 
-
 </menu>
diff --git a/src/ro/ieval/unical/AlarmActivity.java b/src/ro/ieval/unical/AlarmActivity.java
deleted file mode 100644 (file)
index 2868764..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package ro.ieval.unical;
-
-import java.util.GregorianCalendar;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.Window;
-
-public class AlarmActivity extends Activity {
-       @Override
-       public void onCreate(Bundle savedInstanceState) {
-               super.onCreate(savedInstanceState);
-               this.requestWindowFeature(Window.FEATURE_NO_TITLE);
-               setContentView(layoutResID);
-               
-               GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();
-               cal.add(GregorianCalendar.SECOND, 5);
-       }
-}
index d864079bbaa3bfb10b238fa1066179e20ccb7793..27eaef5dc26317c53474d25580a55f4a13bd0f8e 100644 (file)
@@ -3,7 +3,6 @@ package ro.ieval.unical;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Date;
-
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
index 703c8ddc2061bb6769e3643e593e4c205f4f86dd..73e27371de292d33837d689faeae123f975e37fe 100644 (file)
@@ -1,7 +1,13 @@
 package ro.ieval.unical;
 
+import java.util.GregorianCalendar;
 import java.util.Locale;
 
+import android.app.Activity;
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
 import android.view.View;
 import android.view.ViewGroup;
 
@@ -20,4 +26,11 @@ final class Utils {
        public static String formatDate(final int year, final int month, final int day){
                return String.format(Locale.ENGLISH, "%4d-%02d-%02d", year, month, day);
        }
+       
+       public static void setAlarm(GregorianCalendar cal,Context context) {
+               Intent in = new Intent(context,AlarmReceiverActivity.class);
+               PendingIntent pi = PendingIntent.getActivity(context, 1234, in, PendingIntent.FLAG_CANCEL_CURRENT);
+               AlarmManager am = (AlarmManager)context.getSystemService(Activity.ALARM_SERVICE);
+               am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pi);
+       }
 }
This page took 0.033137 seconds and 4 git commands to generate.