<?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>Novoda &#187; theme</title>
	<atom:link href="http://novoda.com/tag/theme/feed/" rel="self" type="application/rss+xml" />
	<link>http://novoda.com</link>
	<description>Android mobile development and consultancy</description>
	<lastBuildDate>Wed, 05 Oct 2011 11:15:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Live Wallpapers part 1 &#8211; Animated Live Wallpaper</title>
		<link>http://novoda.com/2010/03/03/live-wallpapers-part-1-animated-live-wallpaper/</link>
		<comments>http://novoda.com/2010/03/03/live-wallpapers-part-1-animated-live-wallpaper/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 12:09:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[livewallpaper]]></category>
		<category><![CDATA[nexusone]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wallpaper]]></category>

		<guid isPermaLink="false">http://novoda.com/?p=364</guid>
		<description><![CDATA[Live wallpapers serve up an impressive introduction to Nexus Ones. Introduced in Android 2.1, these dashboard backgrounds have the advantage of being able to interact with a device programatically.  To celebrate receiving our Nexus Ones at a Londroid / Google Android developer lab have excitedly created some quick LiveWallpapers demos we&#8217;d like to share.
Animated LiveWallpaper
Live [...]]]></description>
			<content:encoded><![CDATA[<p>Live wallpapers serve up an impressive introduction to Nexus Ones. Introduced in Android 2.1, these dashboard backgrounds have the advantage of being able to interact with a device programatically.  To celebrate receiving our Nexus Ones at a Londroid / Google Android developer lab have excitedly created some quick LiveWallpapers demos we&#8217;d like to share.</p>
<h2>Animated LiveWallpaper</h2>
<p>Live Wallpapers offer unique screen real estate over widgets and a chance to show off some dashboard visuals. Childhood memories have instilled a message of freedom into the image of a Testerrossa speeding down an open road with a pretty girl ala &#8220;Ferris Buellers day off&#8221; and Sega&#8217;s classic &#8220;Outrun&#8221;. So What better to express the open platform than an OutRun inspired Live Wallpaper?</p>
<p>A sexy implementation using the openly available <a href="http://github.com/novoda/android/tree/master/Livewallpaper">github source code</a>:<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ZjzAqJL-gNc&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/ZjzAqJL-gNc&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://andappstore.com/AndroidApplications/apps/OutRun_LiveWallpaper">Download the outrun livewallpaper for the Nexus One</a><br />
Scenery changes every time the phone is sleeping as you can see <a title="outrunlivewallpaper-day" href="http://qik.com/video/5226711">here</a>, <a title="outrunlivewallpaper-sunset" href="http://qik.com/video/5226632">here</a> and <a title="outrunlivewallpaper-night" href="http://qik.com/video/5226436">here</a>, in awful quality.</p>
<p>Admittedly my graphics aren&#8217;t quite as inspiring.</p>
<p><a href="http://novoda.com/wp-content/uploads/2010/02/demo_graphics.png"><img class="aligncenter size-full wp-image-368" title="demo_graphics" src="http://novoda.com/wp-content/uploads/2010/02/demo_graphics.png" alt="Demo graphics" width="589" height="292" /></a></p>
<p><a href="http://cloud.github.com/downloads/novoda/android/nexus_livewallpaper_anim.apk">Download Demo apk compiled for a Nexus One</a></p>
<h3>Animated LiveWallpaper Notes</h3>
<p>Src code for Demos projects on Github:<br />
<a href="http://github.com/novoda/android/tree/master/Livewallpaper/switch_leftright/">Switch Image on left/right</a><br />
<a href="http://github.com/novoda/android/tree/master/Livewallpaper/switch_animation/">Switch Animation on left/right</a></p>
<p>A Live Wallpaper consists of an &#8216;Engine&#8217; and a &#8216;Service&#8217;. The engine specifies how your wallpaper is rendered while it&#8217;s service creates instances for the home screen. A wallpaper service differs from a normal service in addition of  OnEngineCreate(). This has been the first time I&#8217;ve used the canvas extensively and I learned you first must lock the canvas and choose which region you wish to redraw. onVisibilityChanged() or onSurfaceChanged() will read much like the instructions of how to draw your canvas from empty. Onvisibility() will first change to true in rendering your wallpaper  preview and this will return false when your wallpaper falls out of view and you transition to your dashboard. This is a handy function as every time your wallpaper falls out of view you can stop everything you are doing and free up the associated resources.</p>
<p>To update the drawn canvas state you need to tell the UI to refresh via a handler. In my case I needed to request an indexed image from within an collection upon each draw, Each time the handler returns back I update my drawn bitmap with a frame from the animation. It should be noted here that you should only be keeping the image Resource IDs in memory rather than the actual binary contents of the images. I was at first doing this, following a demo I downloaded but I soon ran into this error at runtime:</p>
<pre class="sh_java">ERROR/AndroidRuntime(1067):
Uncaught handler: thread main exiting due to uncaught exception
java.lang.OutOfMemoryError: bitmap size exceeds VM budget</pre>
<p>This is because all of the png images although starting out quite small, when transformed to bitmaps upon interpreation they become a lot larger and quickly fill up the allotted memory allocation. Instead I just kept an array of resIds using res.getIdentifier(). This seems pretty good in the performance stakes.</p>
<p>I chose to play an animation for left and right steering when a user flicks between panels. I kept track of this via the onTouchEvent()&#8217;s <a href="http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_DOWN">ACTION_DOWN</a> and then checking which side of the screen their<a href="http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_UP"> ACTION_UP</a> was upon. The reason I added a timer in there was to add a little delay for the animation so you can appreciate the perfect driving line of the Testerossa.An area that I would like to return to is recognising when the user&#8217;s finger has dragged the screen a certain distance. My original approach to recognising significant drag was to monitor the start and end points and see if they lay at different sides of the screen, I have since learned measuring the distance within onOffSetsChanged would probably be a more reliable approach.</p>
<p>The last thing of note with Live Wallpapers is that they have a convenience listener for dropping icons and tapping on the dashboard screen via sendWallpaperCommand() and then acting on the input via onCommand(), these could also be very useful and are used to good effect in the demos with water droplets and colours.</p>
<p>At the moment it seems like the wallpaper is a bit of a memory hog and I&#8217;d like to find out why. Any suggestions are appreciated.<br />
We think that the problem is in the BitmapFactory.decodeResources() function recreating the Bitmap every time. In order to get around this I think the best way would be to create a &#8217;spriteSheet&#8217; then move around the area of this big sheet masking it to only the area I need like one of those revolving wheels that show the horse running. Live and learn, I always wondered why people used sprite sheets in games programming I guess this must be one of the reasons.</p>
<p>As a side note, if anyone has any information on how The Nexus One splash screen is able to read in it&#8217;s splash screen consisting of 97pngs (/system/media/bootanimation.zip)  I&#8217;d love to hear how they achieved this. When developing ideas for your Live Wallpapers consider trying to include the interaction of forces particular to the context of a mobile device such as time, movement and position.</p>
<blockquote><p>Android SDK at time of writing was: <strong>android-sdk-mac_x86-2.1 ( SDK version 7 )</strong></p></blockquote>
<h3>Citations &amp; Research</h3>
<ul>
<li><cite><a href="http://code.google.com/p/android-apps-by-minghai/">Really cute anime live wallpaper on google code</a></cite></li>
<li><cite><a href="http://github.com/novoda/android/tree/master/Livewallpaper/switch_leftright/">Github: Demo of switching left and right</a></cite></li>
<li><cite><a href="http://github.com/novoda/android/tree/master/Livewallpaper/switch_animation/">Github: Demo of switching Animation on left/right</a></cite></li>
<li><cite><a href="http://cloud.github.com/downloads/novoda/android/nexus_livewallpaper_anim.apk">Live Wallpaper anim demo APK for Nexus One</a></cite></li>
</ul>
<script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_java.js"></script>


Share this post:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;partner=sociable" title="Print"><img src="http://novoda.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper&amp;body=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F" title="email"><img src="http://novoda.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;title=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper&amp;bodytext=Live%20wallpapers%20serve%20up%20an%20impressive%20introduction%20to%20Nexus%20Ones.%20Introduced%20in%20Android%202.1%2C%20these%20dashboard%20backgrounds%20have%20the%20advantage%20of%20being%20able%20to%20interact%20with%20a%20device%20programatically.%C2%A0%20To%20celebrate%20receiving%20our%20Nexus%20Ones%20at%20a%20Londroi" title="Digg"><img src="http://novoda.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;title=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper&amp;notes=Live%20wallpapers%20serve%20up%20an%20impressive%20introduction%20to%20Nexus%20Ones.%20Introduced%20in%20Android%202.1%2C%20these%20dashboard%20backgrounds%20have%20the%20advantage%20of%20being%20able%20to%20interact%20with%20a%20device%20programatically.%C2%A0%20To%20celebrate%20receiving%20our%20Nexus%20Ones%20at%20a%20Londroi" title="del.icio.us"><img src="http://novoda.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;title=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper" title="Reddit"><img src="http://novoda.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper%20-%20http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F" title="Twitter"><img src="http://novoda.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;title=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper&amp;annotation=Live%20wallpapers%20serve%20up%20an%20impressive%20introduction%20to%20Nexus%20Ones.%20Introduced%20in%20Android%202.1%2C%20these%20dashboard%20backgrounds%20have%20the%20advantage%20of%20being%20able%20to%20interact%20with%20a%20device%20programatically.%C2%A0%20To%20celebrate%20receiving%20our%20Nexus%20Ones%20at%20a%20Londroi" title="Google Bookmarks"><img src="http://novoda.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;t=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper" title="Facebook"><img src="http://novoda.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;t=Live%20Wallpapers%20part%201%20-%20Animated%20Live%20Wallpaper" title="HackerNews"><img src="http://novoda.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F" title="Technorati"><img src="http://novoda.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fnovoda.com%2F2010%2F03%2F03%2Flive-wallpapers-part-1-animated-live-wallpaper%2F&amp;partner=sociable" title="PDF"><img src="http://novoda.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://novoda.com/2010/03/03/live-wallpapers-part-1-animated-live-wallpaper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

