Code example for SimpleDateFormat

Methods: format

0
         msgStr.append(formatter.format(new Date()));
 
         Toast.makeText(context, msgStr, Toast.LENGTH_LONG).show();
          
         //Release the lock 
         wl.release();
          
	} 
	public void SetAlarm(Context context)
    { 
        AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(context, AlarmManagerBroadcastReceiver.class);
        intent.putExtra(ONE_TIME, Boolean.FALSE);
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0);
        //After after 30 seconds 
        am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 1000 * 5 , pi); 
    } 
 
    public void CancelAlarm(Context context)
    { 
        Intent intent = new Intent(context, AlarmManagerBroadcastReceiver.class);