Code example for Queue

Methods: peek, size

0
 
		Log.d(this.getClass().getName() + "sendNextMessage", "Sending next message in queue");
		/* 
		 * Perform check that the top message should be sent (time has elapsed) 
		 */ 
		if (messageQueue != null && messageQueue.size() != 0)
		{ 
			SMSMessage message = messageQueue.peek();
			if (message != null)
			{ 
				Calendar msgTime = messageQueue.peek().getDateTime();
				if (msgTime.before(Calendar.getInstance()))
				{ 
 
					sendMessage(message);
					removeMessage(message);//Remove from the queue and underlying db
					Log.d(this.getClass().getName() + "sendNextMessage", "Message sent.");
 
					//If message was recurring, insert back into queue with an adjusted date. 
					if (message.getRecurOptions() != null && message.getRecurOptions().isRecurring())
					{