Code example for Vector

Methods: add, size

0
 
	@Override 
	public void scheduleAtFixedRate(Runnable command, long initialDelay,
			long period, TimeUnit unit) {
		 
		tasks.add(command);
		int i = tasks.size() - 1;
		 
		log.info("trying to set up a scheduled event, i = " + i);
		 
		AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        Intent _intent = new Intent(context, AndroidGScheduler.class);
        Uri data = Uri.parse(URI_SCHEME + ":" + i);
        _intent.setData(data);
        am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 
        		INITIAL_DELAY + unit.toMillis(initialDelay),
        		unit.toMillis(period),
        		PendingIntent.getBroadcast(context, 0, _intent, 0));
         
        log.info("done setting up a scheduled event: " + data + ", i = " + i);
	}