<?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/"
	>

<channel>
	<title>Knowledge is Power &#187; Progress</title>
	<atom:link href="http://www.ericmartel.com/category/progress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ericmartel.com</link>
	<description></description>
	<lastBuildDate>Thu, 01 Jul 2010 17:23:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Working NumberPicker and Android</title>
		<link>http://www.ericmartel.com/2010/07/01/working-numberpicker-and-android/</link>
		<comments>http://www.ericmartel.com/2010/07/01/working-numberpicker-and-android/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 17:18:28 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Progress]]></category>

		<guid isPermaLink="false">http://www.ericmartel.com/?p=140</guid>
		<description><![CDATA[For the last few weeks, I&#8217;ve been working on and off on a small android project. For number selection, I wanted to use something similar to what&#8217;s in the Alarm Clock that ships with most Android phones&#8230; a simple control made out of 3 elements, a text field, an &#8220;increase&#8221; button and a &#8220;decrease&#8221; button. [...]]]></description>
			<content:encoded><![CDATA[<p>For the last few weeks, I&#8217;ve been working on and off on a small android project. For number selection, I wanted to use something similar to what&#8217;s in the Alarm Clock that ships with most Android phones&#8230; a simple control made out of 3 elements, a text field, an &#8220;increase&#8221; button and a &#8220;decrease&#8221; button. I was really surprised to see that this is not part of the SDK. After checking on the net, I found this site:</p>
<p><a href="http://www.quietlycoding.com/?p=5">http://www.quietlycoding.com/?p=5</a></p>
<p>It seemed to work well most of the time, but I had a strange behavior that I thought was coming from my side&#8230; After displaying the NumberPicker in a Dialog, I was using an OnClick on some button in this dialog, and sometimes the number I was getting from the picker didn&#8217;t correspond to what was on screen. Also, after seeing the application running on my phone, I decided to show it to my fiancée, and her first try at it broke the NumberPicker! If you hold one of the buttons, the picker will loop infinitely increasing or decreasing the value.</p>
<p>There might be other issues but here&#8217;s my fix to the two of them:</p>
<p>First, the infinitely increasing value problem, it appears that the code that&#8217;s constantly run does not have exit conditions, here&#8217;s how I fixed it:</p>
<pre class="brush: java;">

private final Runnable mRunnable = new Runnable() {
	public void run() {
		boolean repost = false;
		if (mIncrement) {
			changeCurrent(mCurrent + 1);
			if(mIncrementButton.isPressed())
			{
				repost = true;
			}
		} else if (mDecrement) {
			changeCurrent(mCurrent - 1);
			if(mDecrementButton.isPressed())
			{
				repost = true;
			}
		}
		if(repost)
		{
			mHandler.postDelayed(this, mSpeed);
		}
	}
};
</pre>
<p>I simply check if the button is still pressed before reposting the &#8220;increase&#8221; callback.</p>
<p>As for the value, if the text edit was currently being edited and the value was fetched before it lost focus, it was still returning the old value&#8230; the fix is quite simple:</p>
<pre class="brush: java;">

public int getCurrent() {
	validateInput(mText);
	return mCurrent;
}
</pre>
<p>Here&#8217;s the modified <a href="http://ericmartel.com/code/NumberPicker.java">NumberPicker.java</a> to be used with QuietlyCoding&#8217;s package, feel free to comment if you have any questions!</p>
<p>Thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericmartel.com/2010/07/01/working-numberpicker-and-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sunday evening project</title>
		<link>http://www.ericmartel.com/2009/12/13/sunday-evening-project/</link>
		<comments>http://www.ericmartel.com/2009/12/13/sunday-evening-project/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 03:30:57 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Progress]]></category>

		<guid isPermaLink="false">http://www.ericmartel.com/?p=117</guid>
		<description><![CDATA[Since my fiancee is studying hard for her finals, I decided to spend the evening building my Ice Tube Clock from Ada Fruit Industries. At first I wanted to take step by step pictures while assembling it, but there&#8217;s many steps and they&#8217;re all well documented on Limor Fried&#8217;s website so I didn&#8217;t bother. Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Since my fiancee is studying hard for her finals, I decided to spend the evening building my <a href="http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=39&amp;products_id=194&amp;zenid=d35920d36661cc65be19010f216b3ed8">Ice Tube Clock</a> from <a href="http://adafruit.com/">Ada Fruit Industries</a>.</p>
<p>At first I wanted to take step by step pictures while assembling it, but there&#8217;s many steps and they&#8217;re all well documented on <a href="http://www.ladyada.net/make/icetube/solder.html">Limor Fried&#8217;s website</a> so I didn&#8217;t bother.</p>
<p>Here&#8217;s what it looked like after unboxing:</p>
<p><img class="alignnone" title="Unboxing" src="http://farm3.static.flickr.com/2592/4183778396_328b95eeb9.jpg" alt="" width="500" height="375" /></p>
<p>Now what it looked like after unpacking:</p>
<p><img class="alignnone" title="Unpacking" src="http://farm3.static.flickr.com/2777/4183778490_09ac6fb781.jpg" alt="" width="500" height="375" /></p>
<p>And here&#8217;s the finished product:</p>
<p><img class="alignnone" title="Final product" src="http://farm3.static.flickr.com/2606/4183778314_a0c164cac2.jpg" alt="" width="500" height="375" /></p>
<p>Overall I&#8217;m pretty satisfied with it.  I&#8217;ve built it while watching Blade and Iron Man, taking a break to eat&#8230; so that&#8217;s maybe 2h30 to solder it and assemble the case?</p>
<p>As a newbie I found the kit pretty straight forward to assemble.  The final product while being a clock, as promised, feels a bit cheap though.  I&#8217;m not sure what I was expecting to be honest.</p>
<p>I&#8217;d give it a B+/A-&#8230; kind of makes me regret buying it when I see this kit: <a href="http://www.evilmadscientist.com/article.php/bulbdialkit">Bulbdial Clock Kit</a> from <a href="http://www.evilmadscientist.com/">Evil Mad Scientist</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ericmartel.com/2009/12/13/sunday-evening-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
