<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>ryac</title>
	
	<link>http://www.ryac.ca/blog</link>
	<description>★</description>
	<lastBuildDate>Sat, 27 Aug 2011 05:51:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ryac" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="ryac" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>ryac[PA]</title>
		<link>http://www.ryac.ca/blog/2011/08/ryacpa/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ryacpa</link>
		<comments>http://www.ryac.ca/blog/2011/08/ryacpa/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 05:51:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=71</guid>
		<description><![CDATA[My online photo album has been made into an Android app. Look out folks, the &#8216;killer-app&#8217; is out on the market. hah. Download the app to your phone!]]></description>
			<content:encoded><![CDATA[<p><a href="http://goo.gl/MxtYp" target="_blank"><img class="size-full wp-image-73 alignnone" title="ryac[PA]" src="http://www.ryac.ca/blog/wp-content/uploads/2011/08/promo.jpg" alt="ryac[PA]" width="180" height="120" /></a><a href="http://goo.gl/MxtYp"><img class="alignright size-full wp-image-102" title="ryac[PA]-small" src="http://www.ryac.ca/blog/wp-content/uploads/2011/08/ryacPA-small.png" alt="Download the app to your phone!" width="66" height="66" /></a></p>
<p>My online photo album has been made into an Android app. Look out folks, the &#8216;killer-app&#8217; is out on the market.</p>
<p>hah.</p>
<p><a title="Download the app to your phone!" href="http://goo.gl/MxtYp" target="_blank">Download the app to your phone!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2011/08/ryacpa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multi-threading images from the web into an Adapter</title>
		<link>http://www.ryac.ca/blog/2011/08/multi-threading-images-from-the-web-into-an-adapter/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=multi-threading-images-from-the-web-into-an-adapter</link>
		<comments>http://www.ryac.ca/blog/2011/08/multi-threading-images-from-the-web-into-an-adapter/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 06:24:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=47</guid>
		<description><![CDATA[When working with ListViews or GridViews inside Android apps, you may need to load dynamic content, such as photos, from the web into these views. If you&#8217;re not multi-threading your UI will hang. This is because everything is running on a single thread and the latency of the network will make your app unresponsive. Most [...]]]></description>
			<content:encoded><![CDATA[<p>When working with ListViews or GridViews inside Android apps, you may need to load dynamic content, such as photos, from the web into these views. If you&#8217;re not multi-threading your UI will hang. This is because everything is running on a single thread and the latency of the network will make your app unresponsive. Most of the time, if you&#8217;re retrieving anything from the web it&#8217;s better to be multi-threading to keep your UI responsive.</p>
<p>GridViews and ListViews (among others) use Adapters to connect data to your views. There&#8217;s explanation on how to use <a title="Grid View Example" href="http://developer.android.com/resources/tutorials/views/hello-gridview.html" target="_blank">Adapters inside a GridView on the Android Developer&#8217;s site</a>. While this example is great for static content, you&#8217;ll run into problems when loading images from the web.</p>
<p>I&#8217;m currently building an Android app that&#8217;s pretty much my <a title="ryac PhotoAlbum" href="http://www.ryac.ca/photoalbum" target="_blank">photoalbum I have on my site</a>. I&#8217;m loading my thumbnails into a GridView as shown below and from here you can tap on a thumbnail to see a bigger version.</p>
<div id="attachment_49" class="wp-caption alignnone" style="width: 490px"><a href="http://www.ryac.ca/blog/wp-content/uploads/2011/08/grid-view-screen.jpg" target="_blank"><img class="size-full wp-image-49" title="GridView Screen" src="http://www.ryac.ca/blog/wp-content/uploads/2011/08/grid-view-screen.jpg" alt="GridView Screen" width="480" height="800" /></a><p class="wp-caption-text">Screenshot of my photoalbum app, the GridView loading external images</p></div>
<p>While the GridView example on the Android Developer&#8217;s site is great for loading static content, I needed to load images from the web, which means I should be multi-threading. I&#8217;ve done this inside my Adapter and then set my Adapter to my GridView. Below is my ImageAdapter class. I thought the best way to explain this would be explanations in the code itself, check it out..</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">ca.ryac.photoalbum.adapters</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> ...
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImageAdapter <span style="color: #000000; font-weight: bold;">extends</span> BaseAdapter <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Context</span> context<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// stores all data for album..</span>
	<span style="color: #000000; font-weight: bold;">private</span> ArrayList<span style="color: #339933;">&lt;</span>HashMap<span style="color: #339933;">&lt;</span>String, Object<span style="color: #339933;">&gt;&gt;</span> photos<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// my folder I'm currently loading from..</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> folder<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// views stores all the loaded ImageViews linked to their</span>
	<span style="color: #666666; font-style: italic;">// position in the GridView; hence &lt;Integer, ImageView&gt; in</span>
	<span style="color: #666666; font-style: italic;">// the HashMap..</span>
	<span style="color: #000000; font-weight: bold;">private</span> HashMap<span style="color: #339933;">&lt;</span>Integer, ImageView<span style="color: #339933;">&gt;</span> views<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> ImageAdapter <span style="color: #009900;">&#40;</span><span style="color: #003399;">Context</span> c, <span style="color: #003399;">String</span> f, ArrayList<span style="color: #339933;">&lt;</span>HashMap<span style="color: #339933;">&lt;</span>String, Object<span style="color: #339933;">&gt;&gt;</span> p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		context <span style="color: #339933;">=</span> c<span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// I need to hold a reference to my current album folder..</span>
		folder <span style="color: #339933;">=</span> f<span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// photos stores all of my data for the album, this includes</span>
		<span style="color: #666666; font-style: italic;">// the filename, some other stuff I'm not using..</span>
		photos <span style="color: #339933;">=</span> p<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// 'views' is a HashMap that holds all</span>
 		<span style="color: #666666; font-style: italic;">// of the loaded ImageViews linked to their position</span>
		<span style="color: #666666; font-style: italic;">// inside the GridView. it's used for checking to see if</span>
		<span style="color: #666666; font-style: italic;">// the particular ImageView has already been loaded</span>
		<span style="color: #666666; font-style: italic;">// (inside the getView method) and if not, creates the</span>
		<span style="color: #666666; font-style: italic;">// new ImageView and stores it in the HashMap along with</span>
		<span style="color: #666666; font-style: italic;">// its position.. </span>
		views <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>Integer, ImageView<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getCount<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> photos.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Object</span> getItem<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> position<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">long</span> getItemId<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> position<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">View</span> getView<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #003399;">View</span> view, ViewGroup parent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		ImageView v<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// get the ImageView for this position in the GridView..</span>
		v <span style="color: #339933;">=</span> views.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// this ImageView might not be created yet..</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>v <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span>Constants.<span style="color: #006633;">TAG</span>, <span style="color: #0000ff;">&quot;This view is not created. create it.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// create a new ImageView..</span>
			v <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ImageView<span style="color: #009900;">&#40;</span>context<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			v.<span style="color: #006633;">setLayoutParams</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GridView.<span style="color: #006633;">LayoutParams</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">110</span>, <span style="color: #cc66cc;">110</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			v.<span style="color: #006633;">setPadding</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// I'm setting a default image here so that you don't</span>
			<span style="color: #666666; font-style: italic;">// see black nothingness.. (just using an icon that</span>
			<span style="color: #666666; font-style: italic;">// comes with the Android SDK)</span>
			v.<span style="color: #006633;">setImageResource</span><span style="color: #009900;">&#40;</span>android.<span style="color: #006633;">R</span>.<span style="color: #006633;">drawable</span>.<span style="color: #006633;">ic_menu_gallery</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// get the filename that this ImageView will hold..</span>
			<span style="color: #003399;">String</span> file <span style="color: #339933;">=</span> photos.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// pass this Bundle along to the LoadImage class,</span>
			<span style="color: #666666; font-style: italic;">// which is a subclass of Android's utility class</span>
			<span style="color: #666666; font-style: italic;">// AsyncTask. Whatever happens in this class is</span>
			<span style="color: #666666; font-style: italic;">// on its own thread.. the Bundle passes</span>
			<span style="color: #666666; font-style: italic;">// the file to load and the position the photo</span>
			<span style="color: #666666; font-style: italic;">// should be placed in the GridView..</span>
			Bundle b <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Bundle <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			b.<span style="color: #006633;">putString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span>, file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			b.<span style="color: #006633;">putInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pos&quot;</span>, position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// just a test to make sure that the position and</span>
			<span style="color: #666666; font-style: italic;">// file name are matching before and after the</span>
			<span style="color: #666666; font-style: italic;">// image has loaded..</span>
			Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span>Constants.<span style="color: #006633;">TAG</span>, <span style="color: #0000ff;">&quot;*before: &quot;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pos&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; | &quot;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// this executes a new thread, passing along the file</span>
			<span style="color: #666666; font-style: italic;">// to load and the position via the Bundle..</span>
			<span style="color: #000000; font-weight: bold;">new</span> LoadImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// puts this new ImageView and position in the HashMap.</span>
			views.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>position, v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// return the view to the GridView..</span>
		<span style="color: #666666; font-style: italic;">// at this point, the ImageView is only displaying the</span>
		<span style="color: #666666; font-style: italic;">// default icon..</span>
		<span style="color: #000000; font-weight: bold;">return</span> v<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// this is the class that handles the loading of images from the cloud</span>
	<span style="color: #666666; font-style: italic;">// inside another thread, separate from the main UI thread..</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> LoadImage <span style="color: #000000; font-weight: bold;">extends</span> AsyncTask<span style="color: #339933;">&lt;</span>Bundle, <span style="color: #003399;">Void</span>, Bundle<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		@Override
		<span style="color: #000000; font-weight: bold;">protected</span> Bundle doInBackground<span style="color: #009900;">&#40;</span>Bundle... <span style="color: #006633;">b</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// get the file that was passed from the bundle..</span>
			<span style="color: #003399;">String</span> file <span style="color: #339933;">=</span> b<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// fetchPhoto is a helper method to get the photo..</span>
			<span style="color: #666666; font-style: italic;">// returns a Bitmap which we'll place inside the</span>
			<span style="color: #666666; font-style: italic;">// appropriate ImageView component..</span>
			Bitmap bm <span style="color: #339933;">=</span> fetchPhoto<span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// now that we have the bitmap (bm), we'll</span>
			<span style="color: #666666; font-style: italic;">// create another bundle to pass to 'onPostExecute'.</span>
			<span style="color: #666666; font-style: italic;">// this is the method that is called at the end of </span>
			<span style="color: #666666; font-style: italic;">// our task. like a callback function..</span>
			<span style="color: #666666; font-style: italic;">// this time, we're not passing the filename to this</span>
			<span style="color: #666666; font-style: italic;">// method, but the actual bitmap, not forgetting to</span>
			<span style="color: #666666; font-style: italic;">// pass the same position along..</span>
			Bundle bundle <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Bundle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			bundle.<span style="color: #006633;">putParcelable</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bm&quot;</span>, bm<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			bundle.<span style="color: #006633;">putInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pos&quot;</span>, b<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			bundle.<span style="color: #006633;">putString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span>, file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// this is only used for testing..</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">return</span> bundle<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		@Override
		<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onPostExecute<span style="color: #009900;">&#40;</span>Bundle result<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onPostExecute</span><span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// just a test to make sure that the position and</span>
			<span style="color: #666666; font-style: italic;">// file name are matching before and after the</span>
			<span style="color: #666666; font-style: italic;">// image has loaded..</span>
			Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span>Constants.<span style="color: #006633;">TAG</span>, <span style="color: #0000ff;">&quot;*after: &quot;</span> <span style="color: #339933;">+</span> result.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pos&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; | &quot;</span> <span style="color: #339933;">+</span> result.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// here's where the photo gets put into the</span>
			<span style="color: #666666; font-style: italic;">// appropriate ImageView. we're retrieving the</span>
			<span style="color: #666666; font-style: italic;">// ImageView from the HashMap according to</span>
			<span style="color: #666666; font-style: italic;">// the position..</span>
			ImageView view <span style="color: #339933;">=</span> views.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>result.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// then we set the bitmap into that view. and that's it.</span>
			view.<span style="color: #006633;">setImageBitmap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>Bitmap<span style="color: #009900;">&#41;</span> result.<span style="color: #006633;">getParcelable</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// this is a helper method to retrieve the photo from the cloud..</span>
	<span style="color: #000000; font-weight: bold;">private</span> Bitmap fetchPhoto <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> file<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Bitmap bm <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">String</span> path <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.path_to_photoalbums_here.ca/&quot;</span> <span style="color: #339933;">+</span> file<span style="color: #339933;">;</span>
&nbsp;
		Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span>Constants.<span style="color: #006633;">TAG</span>, <span style="color: #0000ff;">&quot;path: &quot;</span> <span style="color: #339933;">+</span> path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">final</span> HttpParams httpParameters <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BasicHttpParams<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// Set the timeout in milliseconds until a connection is established.</span>
			HttpConnectionParams.<span style="color: #006633;">setConnectionTimeout</span><span style="color: #009900;">&#40;</span>httpParameters, <span style="color: #cc66cc;">7000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Set the default socket timeout (SO_TIMEOUT)</span>
			<span style="color: #666666; font-style: italic;">// in milliseconds which is the timeout for waiting for data.</span>
			HttpConnectionParams.<span style="color: #006633;">setSoTimeout</span><span style="color: #009900;">&#40;</span>httpParameters, <span style="color: #cc66cc;">10000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">final</span> HttpClient client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DefaultHttpClient<span style="color: #009900;">&#40;</span>httpParameters<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">final</span> HttpResponse response <span style="color: #339933;">=</span> client.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> HttpGet<span style="color: #009900;">&#40;</span>path<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">final</span> HttpEntity entity <span style="color: #339933;">=</span> response.<span style="color: #006633;">getEntity</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">InputStream</span> imageContentInputStream <span style="color: #339933;">=</span> entity.<span style="color: #006633;">getContent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// wrapping the imageContentInputStream with FlushedInputStream.</span>
			bm <span style="color: #339933;">=</span> BitmapFactory.<span style="color: #006633;">decodeStream</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FlushedInputStream <span style="color: #009900;">&#40;</span>imageContentInputStream<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span>Constants.<span style="color: #006633;">TAG</span>, e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> bm<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And inside my Activity class, I simply connect the Adapter to the GridView:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> setAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	grid.<span style="color: #006633;">setAdapter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ImageAdapter<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, folder, photos<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I did run into another problem with loading the images into my app, not only in my GridView but also when viewing the bigger version of the photo. The bitmap would not display and no obvious errors came up. Looking at the logcat I found this: &#8220;<b>skia decoder->decode returned false</b>&#8220;. I&#8217;ve read that this happens over slow connections but my connection seems pretty fast so after searching around I found <a href="http://www.gitshah.com/2011/05/fixing-skia-decoder-decode-returned.html" target="_blank">a solution to the &#8216;decoder->decode returned false&#8217; problem here</a>. There are actually two solutions explained. Try both if the first method didn&#8217;t work for you &#8211; I was originally using the second method while getting the &#8216;decoder->decode returned false&#8217; problem. I then tried the first method and that worked.</p>
<p>I hope this helps to shed some light on multi-threading images from the cloud into your Adapters for various Views. If you see areas of improvement please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2011/08/multi-threading-images-from-the-web-into-an-adapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Robotlegs / AS3 Signals Flickr Example</title>
		<link>http://www.ryac.ca/blog/2011/07/robotlegs-as3-signals-flickr-example/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=robotlegs-as3-signals-flickr-example</link>
		<comments>http://www.ryac.ca/blog/2011/07/robotlegs-as3-signals-flickr-example/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 00:18:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=38</guid>
		<description><![CDATA[I&#8217;ve been spending some time with Robotlegs these days. I find it great to use and coming from PureMVC it was relatively easy to get the basics down. What really helped me out a lot was Joel Hooks posts: http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-1-context-and-mediators/ http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-2-models/ http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-3-services/ And for working with Signals in RL: http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/ I&#8217;ve created a simple app to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been spending some time with <a href="http://www.robotlegs.org/" target="_blank">Robotlegs</a> these days. I find it great to use and coming from PureMVC it was relatively easy to get the basics down.</p>
<p>What really helped me out a lot was Joel Hooks posts:</p>
<p><a href="http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-1-context-and-mediators/" target="_blank">http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-1-context-and-mediators/</a><br />
<a href="http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-2-models/" target="_blank"> http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-2-models/</a><br />
<a href="http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-3-services/" target="_blank"> http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-3-services/</a></p>
<p>And for working with Signals in RL:</p>
<p><a href="http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/" target="_blank">http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/</a></p>
<p>I&#8217;ve created a <a href="http://www.ryac.ca/experiments/rl-flickr/" target="_blank">simple app</a> to help me understand the communication between mediators, controllers, and models/services. The app searches for photos on Flickr and presents them in a list, clicking on an item in the list loads the photo. I first tried this with using Events, then moved on to using Signals. You can <a href="https://github.com/ryac/rl-flickr" target="_blank">download the source</a> for this on gitub.</p>
<p>Let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2011/07/robotlegs-as3-signals-flickr-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10,000 Hours. How Long is That?</title>
		<link>http://www.ryac.ca/blog/2010/01/10000-hours-how-long-is-that/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=10000-hours-how-long-is-that</link>
		<comments>http://www.ryac.ca/blog/2010/01/10000-hours-how-long-is-that/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 08:14:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=18</guid>
		<description><![CDATA[Malcolm Gladwell writes in his book, &#8220;Outliers&#8221;, about how long it takes to become really good at anything complex, from building a gigantic software company to becoming a legendary musician. Researchers say it&#8217;s 10,000 hours. How long is that? You can find out below.. 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_10000_hours_2015938746"
			class="flashmovie"
			width="360"
			height="500">
	<param name="movie" value="http://www.ryac.ca/blog/wp-content/uploads/2010/01/10000_hours.swf" />
	<param name="menu" value="false" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.ryac.ca/blog/wp-content/uploads/2010/01/10000_hours.swf"
			name="fm_10000_hours_2015938746"
			width="360"
			height="500">
		<param name="menu" value="false" />
	<!--<![endif]-->
		 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>]]></description>
			<content:encoded><![CDATA[<p>Malcolm Gladwell writes in his book, &#8220;Outliers&#8221;, about how long it takes to become <em>really</em> good at anything complex, from building a gigantic software company to becoming a legendary musician. Researchers say it&#8217;s 10,000 hours. How long is that? You can find out below..</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_10000_hours_2112166479"
			class="flashmovie"
			width="360"
			height="500">
	<param name="movie" value="http://www.ryac.ca/blog/wp-content/uploads/2010/01/10000_hours.swf" />
	<param name="menu" value="false" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.ryac.ca/blog/wp-content/uploads/2010/01/10000_hours.swf"
			name="fm_10000_hours_2112166479"
			width="360"
			height="500">
		<param name="menu" value="false" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2010/01/10000-hours-how-long-is-that/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Undocumented “addFrameScript” Method</title>
		<link>http://www.ryac.ca/blog/2008/05/the-undocumented-addframescript-method/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-undocumented-addframescript-method</link>
		<comments>http://www.ryac.ca/blog/2008/05/the-undocumented-addframescript-method/#comments</comments>
		<pubDate>Fri, 09 May 2008 01:28:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=9</guid>
		<description><![CDATA[There&#8217;s a useful function inside the MoveClip class (AS3) that will add script inside a Movieclip on a specific frame without actually having to add it manually to the timeline. This is great if, say you have someone working purely on animation and then someone else working on the interface to hold/play/control the animation. A lot of [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a useful function inside the MoveClip class (AS3) that will add script inside a Movieclip on a specific frame without actually having to add it manually to the timeline. This is great if, say you have someone working purely on animation and then someone else working on the interface to hold/play/control the animation. A lot of times this person will need to know when then animation has completed and will therefore need to add script inside the MovieClip animation. The addFrameScript can do this for you without altering the animation and re-exporting, etc.</p>
<p>The function takes two parameters: frame number to place the script (0 based) and the function name to call.</p>
<p><strong>public function addFrameScript (frame:uint, notify:Function):void;</strong></p>
<p>Example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;">// animation is the name of the movieclip.. </span>
animation.<span style="color: #006600;">addFrameScript</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">77</span>, onAnimationEnd<span style="color: #66cc66;">&#41;</span>;      
&nbsp;
<span style="color: #808080; font-style: italic;">// function called when playhead reaches 76.. </span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onAnimationEnd <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> 
	<span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;onAnimationEnd..&quot;</span><span style="color: #66cc66;">&#41;</span>; 
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2008/05/the-undocumented-addframescript-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StopWatch Class</title>
		<link>http://www.ryac.ca/blog/2008/03/stopwatch-class/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=stopwatch-class</link>
		<comments>http://www.ryac.ca/blog/2008/03/stopwatch-class/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 07:23:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=8</guid>
		<description><![CDATA[I worked on a couple projects a while back that required a stopwatch (or timer) to keep track of time in a game, so I made this StopWatch class. Found it very helpful so I wanna share it. Besides the basic functions of starting, stopping, and resetting, you can also pass in a TextFormat object to change the formatting of the text, get the time in [...]]]></description>
			<content:encoded><![CDATA[<p>I worked on a couple projects a while back that required a stopwatch (or timer) to keep track of time in a game, so I made this StopWatch class. Found it very helpful so I wanna share it. Besides the basic functions of starting, stopping, and resetting, you can also pass in a TextFormat object to change the formatting of the text, get the time in milliseconds (it&#8217;s what I used to store in the database), and parse the milliseconds back into something more readable..</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_sw_990638578"
			class="flashmovie"
			width="350"
			height="150">
	<param name="movie" value="http://www.ryac.ca/blog/content/sw.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.ryac.ca/blog/content/sw.swf"
			name="fm_sw_990638578"
			width="350"
			height="150">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here&#8217;s how to use it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> ca.<span style="color: #006600;">ryac</span>.<span style="color: #006600;">StopWatch</span>;        
&nbsp;
<span style="color: #808080; font-style: italic;">// creates a StopWatch obj and sets the formatting to the txtFormat obj.. </span>
<span style="color: #808080; font-style: italic;">// last parameter will set embeddedFonts to either true or false (default is false).. </span>
<span style="color: #000000; font-weight: bold;">var</span> sw:StopWatch = <span style="color: #000000; font-weight: bold;">new</span> StopWatch <span style="color: #66cc66;">&#40;</span>txtFormat, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;        
&nbsp;
<span style="color: #808080; font-style: italic;">// pretty self-explanatory.. </span>
sw.<span style="color: #0066CC;">start</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
sw.<span style="color: #0066CC;">stop</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
sw.<span style="color: #006600;">reset</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;        
&nbsp;
<span style="color: #808080; font-style: italic;">// set or change the formatting and sets embeddedFonts to true.. </span>
sw.<span style="color: #0066CC;">setTextFormat</span> <span style="color: #66cc66;">&#40;</span>txtFormat2, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;        
&nbsp;
<span style="color: #808080; font-style: italic;">// output the time in milliseconds </span>
<span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span>sw.<span style="color: #0066CC;">time</span><span style="color: #66cc66;">&#41;</span>;        
&nbsp;
StopWatch.<span style="color: #006600;">parseTime</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">87292</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// returns 01:27:29</span></pre></td></tr></table></div>

<p>Download <a href="http://www.ryac.ca/blog/content/StopWatch.as" title="StopWatch.as file">StopWatch.as</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2008/03/stopwatch-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Japanese “Flash Card” Application for Flash Lite Devices</title>
		<link>http://www.ryac.ca/blog/2008/03/japanese-flash-card-application-for-flash-lite-phones/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=japanese-flash-card-application-for-flash-lite-phones</link>
		<comments>http://www.ryac.ca/blog/2008/03/japanese-flash-card-application-for-flash-lite-phones/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 07:25:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Lite]]></category>
		<category><![CDATA[Japanese]]></category>

		<guid isPermaLink="false">http://www.ryac.ca/blog/?p=6</guid>
		<description><![CDATA[I started learning Japanese not too long ago and to help me with my studies I made a small app to familiarize myself with the Hiragana and Katakana characters. It proved to be very useful while waiting for the bus, taking the train, etc. Here&#8217;s some screen shots:   You can choose to randomly display the characters for [...]]]></description>
			<content:encoded><![CDATA[<p>I started learning Japanese not too long ago and to help me with my studies I made a small app to familiarize myself with the Hiragana and Katakana characters. It proved to be very useful while waiting for the bus, taking the train, etc.</p>
<p>Here&#8217;s some screen shots:</p>
<p><img border="1" src="http://www.ryac.ca/blog/content/jpfca_01.jpg" alt="JP Flash Card App 1" height="320" width="240" /> <img border="1" src="http://www.ryac.ca/blog/content/jpfca_02.jpg" alt="JP Flash Card App 2" height="320" width="240" /></p>
<p>You can choose to randomly display the characters for each character set and also show or hide names when the card is first displayed.</p>
<p>I&#8217;ve been testing on a Nokia E65 and works well. If you&#8217;ve seen this app before, you might have read my comment about the small bug that appeared in Flash Lite 2.x &#8211; how the first card was not matching the romanji name. The problem was not enough time was given to completely load the swf before calling some script. I&#8217;ve fixed this by giving more time (read as: inserting more frames) for the swf to load completely before calling any script on it. This way, the swf fully loads and is able to jump to the correct frame to match the romanji. So it works in FL 1.1, 2.x, and 3.0 now but I found it a bit strange how this problem only appeared in the newer FL versions (2.x &amp; 3.0).</p>
<p>Please feel free to <a href="http://www.ryac.ca/blog/content/Japanese.zip" title="Japanese Flash Card App">download it here</a> and give it a try. If you&#8217;re studying Japanese I hope it helps!</p>
<p>To find out if your phone has Flash Lite pre-installed, <a target="_blank" href="http://www.ryac.ca/blog/content/Devices-with-FL-pre-installed.pdf" title="Devices with FL pre-installed">download this pdf file</a> originally available on <a target="_blank" href="http://www.flashdevices.net/" title="Flash Devices">Bill Perry</a>&#8216;s blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryac.ca/blog/2008/03/japanese-flash-card-application-for-flash-lite-phones/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

