<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BlackBerry Developer Blog &#187; timer</title>
	<atom:link href="http://devblog.blackberry.com/tag/timer/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.blackberry.com</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 18:00:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devblog.blackberry.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/9ef0a66c09615fa946c4179662398878?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>BlackBerry Developer Blog &#187; timer</title>
		<link>http://devblog.blackberry.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devblog.blackberry.com/osd.xml" title="BlackBerry Developer Blog" />
	<atom:link rel='hub' href='http://devblog.blackberry.com/?pushpress=hub'/>
		<item>
		<title>Hey conference and event organizers, the Talk Clock App is here for you</title>
		<link>http://devblog.blackberry.com/2012/05/conference_app/</link>
		<comments>http://devblog.blackberry.com/2012/05/conference_app/#comments</comments>
		<pubDate>Wed, 23 May 2012 20:48:57 +0000</pubDate>
		<dc:creator>demianborba</dc:creator>
				<category><![CDATA[Adobe AIR Development]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[blackberry app world]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[Demian Borba]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[hackathon]]></category>
		<category><![CDATA[playbook]]></category>
		<category><![CDATA[playbook apps]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=9496</guid>
		<description><![CDATA[(Editor&#8217;s note: Originally published on  http://dborba.com/?p=166 . Demian built and released this app prior to joining the Developer Evangelist team.) Being an event organizer myself with events such as Adobe Camp Brasil and Hackathon San Diego, and also seeing in so many events the big need to: 1) keep track of talks duration 2) show big enough messages [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9496&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>(<em>Editor&#8217;s note: Originally published on <a href="http://dborba.com/?p=166"><br />
http://dborba.com/?p=166<br />
</a>. Demian built and released this app prior to joining the Developer Evangelist team.)</em></p>
<p>Being an event organizer myself with events such as <a title="adobe camp brasil 2012" href="http://events.actioncreations.com/adobecampbrasil2012/english/" target="_blank">Adobe Camp Brasil</a> and <a title="hackathon san diego 2011" href="http://www.hackathonsandiego.com/" target="_blank">Hackathon San Diego</a>, and also seeing in so many events the big need to:</p>
<p>1) keep track of talks duration</p>
<p>2) show big enough messages from a distance to the speaker (like “Go Faster, 5 minutes left”)</p>
<p>3) do very FUN raffles</p>
<p>In March of 2012 I set the last project for <a title="action creations" href="http://www.actioncreations.com/" target="_blank">Action Creations</a> under my administration, called “Talk Clock”, to have a very polished design, focused on being very functional. After tons of prototypes and usability tests, it’s finally ready! And I’m proud to show it to you now:<br />
<span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/Lj0Y7pTmdYM?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p>As event organizer, you can have someone holding the tablet (showing it to the speaker) so he/she can see the time left and see your messages. During the raffle, you can plug the tablet to the projector via HDMI and show its screen to the whole audience.</p>
<p>The Talk Clock App is available only for the BlackBerry® PlayBook™ (and soon BlackBerry 10 smartphones) and it can be found <a title="talk clock app" href="http://appworld.blackberry.com/webstore/content/114473/?lang=en">here</a>. Hope you enjoy it!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/9496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/9496/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=9496&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/05/conference_app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8c9ef384438a2192d22b10543509dab?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dborbarim</media:title>
		</media:content>
	</item>
		<item>
		<title>BlackBerry API Hidden Gems (Part Two)</title>
		<link>http://devblog.blackberry.com/2009/08/blackberry-api-hidden-gems-part-two/</link>
		<comments>http://devblog.blackberry.com/2009/08/blackberry-api-hidden-gems-part-two/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 12:22:00 +0000</pubDate>
		<dc:creator>Denver C.</dc:creator>
				<category><![CDATA[Java Development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[IntVector]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=850</guid>
		<description><![CDATA[In yesterday's BlackBerry API Hidden Gems post, I showed you some of my favorite classes and methods oft overlooked within BlackBerry® APIs. I've got a few more in store for you today, so let's get started! [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=850&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p style="text-align:center;"><img class="aligncenter size-full wp-image-837" title="hidden gems" src="http://rimdevblog.files.wordpress.com/2009/08/hidden-gems.jpg?w=480&#038;h=360" alt="" width="480" height="360" /></p>
<p>In yesterday&#8217;s <a href="http://devblog.blackberry.com/2009/08/blackberry-api-hidden-gems-part-one/">BlackBerry API Hidden Gems post</a>, I showed you some of my favorite classes and methods oft overlooked within BlackBerry® APIs. I&#8217;ve got a few more in store for you today, so let&#8217;s get started!</p>
<h2>IntVector</h2>
<p>In the net.rim.device.api.util package there are a bunch of collections for storing primitive Java types, such as ‘int’, ‘byte’, and ‘long’, which mirror the equivalent java.util classes.  Using these classes to store the primitive types is more efficient in both memory and time than storing wrapper objects in standard java.util collections.</p>
<p>My favourite example is IntVector.  IntVector has the same methods as java.util.Vector but stores primitive ‘int’ values instead of Object references.  Under the hood it uses an int[] array to store values instead of an Object[] array and therefore no conversions between ‘int’ and Integer are necessary.   This makes IntVector much better for storing ‘int’ values than java.util.Vector as it is both faster and uses less memory.  It is also fully synchronized, just like java.util.Vector.</p>
<p>Other adapted classes in net.rim.device.api.util include:</p>
<ul>
<li>ByteVector and LongVector: similar to IntVector but for ‘byte’ and ‘long’ types.</li>
<li>IntHashtable, LongHashtable: adaptations of Hashtable that use primitive ‘int’ and ‘long’ values as the keys, and Objects as the values.</li>
<li>ToIntHashtable, ToLongHashtable: similar to IntHashtable and LongHashtable but uses Objects for the keys and ‘int’ and ‘long’ for the values.</li>
</ul>
<p>Here is an example usage of IntVector to store a list of high scores, with the highest scores at the lowest indices.</p>
<div class="sample">
<p><code>public class HighScores {</code></p>
<p>private IntVector _scores;</p>
<p>public HighScores() {<br />
_scores = new IntVector();<br />
}</p>
<p>public void add(int score) {<br />
if (_scores.contains(score)) {<br />
return; // already there<br />
}</p>
<p>boolean isAdded = false;<br />
for (int i = 0; i &lt; _scores.size(); i++) {<br />
if (_scores.elementAt(i) &lt; score) {                 _scores.insertElementAt(score, i);                 isAdded = true;                 break;             }         }         if (!isAdded) {             _scores.addElement(score);         }         while (_scores.size() &gt; 10) {<br />
_scores.removeElementAt(_scores.size() &#8211; 1);<br />
}<br />
}</p>
<p>public int getHighScore() {<br />
if (_scores.isEmpty()) {<br />
return 0;<br />
} else {<br />
return _scores.elementAt(0);<br />
}<br />
}</p>
<p>public int[] getHighScores() {<br />
int[] array = new int[_scores.size()];<br />
_scores.copyInto(array);<br />
return array;<br />
}<br />
}</p>
</div>
<h2>Timer and TimerTask</h2>
<p>Like weak references, this next gem is also defined in CLDC but is mostly overlooked for its utility.  Suppose you want to perform background tasks in your application.  You can either use Application.invokeLater() or devise a grandiose background thread implementation that cleverly uses Java® synchronization primitives to efficiently perform background event dispatching.  The former consumes your application’s event thread, potentially causing UI lag, and the latter is just a lot of work.</p>
<p>I recommend whipping out Timer and TimerTask for background task processing.  Each Timer object has exactly one background thread which processes TimerTasks sequentially.  These tasks can be scheduled to occur immediately, after some delay, at a particular time, or repeatedly at a given interval.</p>
<p>The sample below shows how to use Timer and TimerTask to notify an object on a non-event thread about the user pressing the trackball.</p>
<div class="sample">
<p><code>public class MyScreen extends net.rim.device.api.ui.container.MainScreen {</code></p>
<p>private Timer _timer;</p>
<p>public MyScreen() {<br />
this.setTitle(&#8220;Timer Demo&#8221;);<br />
this._timer = new Timer();<br />
}</p>
<p>public void onTrackballClick() {<br />
System.out.println(&#8220;Quit pressing the trackball!&#8221;);<br />
}</p>
<p>protected boolean navigationClick(int status, int time) {<br />
this._timer.schedule(new ClickTask(), 0);<br />
return super.navigationClick(status, time);<br />
}</p>
<p>private class ClickTask extends TimerTask {<br />
public void run() {<br />
onTrackballClick();<br />
}<br />
}<br />
}</p>
</div>
<p>There are many more hidden gems in the BlackBerry® SDK but just not enough time here to share them all.  I will be doing a talk on this topic at the <a title="2009 BlackBerry Developer Conference" href="http://www.blackberrydeveloperconference.com/" target="_new">2009 BlackBerry Developer Conference</a> and plan to talk about some hidden gems not mentioned here as well as some lesser-known cool features of the JDE itself.  If you have found any hidden gems of your own please comment on this post to share your great discovery with the world!  I’d love to know which APIs you find useful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/850/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/850/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=850&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2009/08/blackberry-api-hidden-gems-part-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/035dc37bb725cb59d3b846aeb8a55c6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">denvercon1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2009/08/hidden-gems.jpg" medium="image">
			<media:title type="html">hidden gems</media:title>
		</media:content>
	</item>
	</channel>
</rss>
