<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>a.muse: Android Sheep</title>
    <link>http://www.jessirae.com/blog/articles/2008/03/22/android-sheep</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Android Sheep</title>
      <description>&lt;p&gt;&lt;strong&gt;The Goal&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Using the Android development kit, &lt;a href="http://draves.org/blog/archives/000549.html"&gt;create an Android application&lt;/a&gt; that allows users to scroll through images of &lt;a href="http://www.electricsheep.org"&gt;electric sheep&lt;/a&gt; and vote on which images they like.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;First impression of Android: rich, open &lt;span class="caps"&gt;API&lt;/span&gt; with quick-n-easy dev set up&lt;/strong&gt;&lt;/p&gt;


Holy shit! The documentation is like drinking from a &lt;a href="http://www.oreillynet.com/onjava/blog/2007/11/android_first_impressions.html"&gt;water hose&lt;/a&gt;, definitely worse than a JavaDoc.  The pay off is that there is a ton of features that &amp;#8220;come with&amp;#8221; this open source &lt;span class="caps"&gt;SDK&lt;/span&gt;.  As mentioned on &lt;a href="http://www.androidlinux.com/"&gt;android linux&lt;/a&gt;,  
	&lt;blockquote&gt;
		&lt;p&gt;usually you have major companies forming an oligarchy of mobile handset programming, but not so much with Android, anyone, even the girl next door, could be the person making the next great Android based mobile application.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;And if you are familiar with Eclipse and HttpClient and jaxp and a slew of other things int the java world, then developing an Android app should be a snap. :-)&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;First lesson learned: keep your performance tuning cap on&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Go ahead and resize all images to fit the phone screen.  One &lt;a href="http://code.google.com/p/android/issues/detail?id=175"&gt;issue&lt;/a&gt; that &lt;a href="http://www.devchix.org"&gt;Gloria&lt;/a&gt; and I encountered was that switching between images in the image switcher was slow.  I am not sure what the best way to do this is if you do not know the screen size; i mean i guess you would simply detect the screen size and choose the corresponding image size, but this assumes that the appropriately sized image would be available to you.&lt;/p&gt;


	&lt;p&gt;I did change the scaletype to &lt;span class="caps"&gt;CENTER&lt;/span&gt;, but I didn&amp;#8217;t really notice a big performance difference&amp;#8230; I mean I couldn&amp;#8217;t even tell which one was faster.  Per the moderator&amp;#8217;s comments&amp;#8230; the thumbnail isn&amp;#8217;t stretched.  The thumbnail and the png are two different files.  But the &amp;#8216;stretching&amp;#8217; that could be giving us problems is the shrinking of the png to fit it inside the small screen&amp;#8212;I can see this because when the scaletype is set to &lt;span class="caps"&gt;CENTER&lt;/span&gt; or not set at all, the image appears much larger and not all of it fits on the screen.  But so, unless we resize the images, there will always be some stretching/shrinking&amp;#8230; it seems reasonable to close the ticket; we can optimize by resizing if there continues to be a performance issue.  Anyways&amp;#8230; interesting stuff.  I am beginning to see what some of the challenges would be in writing a mobile app.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Second lesson learned: be mindful of your focus&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Either do not set the focus on the ImageView or pass in the gallery so you can set the focus back to the gallery.  I received some &lt;a href="http://groups.google.com/group/android-beginners/browse_thread/thread/137db51ea2f394a2"&gt;great help&lt;/a&gt; from the Android Beginners Google Group.&lt;/p&gt;


&lt;em&gt;Setup Tips&lt;/em&gt;
	&lt;ol&gt;
	&lt;li&gt;Another issue that tripped me up was logging.  Sysouts won&amp;#8217;t work&amp;#8230; or at least Android provides its own logging.  This &lt;a href="http://www.winksaville.com/blog/programming/debug-logging-in-android/"&gt;logging how to&lt;/a&gt; helped me out.  The short of it is use &amp;#8220;adb logcat&amp;#8221; command to view logging done by android.util.Log.&lt;/li&gt;
		&lt;li&gt;Don&amp;#8217;t waste time decompiling; &lt;a href="http://code.google.com/p/android/"&gt;get the source&lt;/a&gt;.  Although it never fails, I end up decompiling stuff anyways.  &lt;code&gt;&amp;lt;^_^&amp;gt;&lt;/code&gt;&lt;/li&gt;
	&lt;/ol&gt;


&lt;center&gt;
&lt;img src="http://www.jessirae.com/blog/images/androidSheep.jpg" width="200" /&gt;
&lt;/center&gt;
&lt;p&gt;&lt;em&gt;Updates to Come&lt;/em&gt;:
I wrote this post some time ago, and there are several cool things that I have learned since that time&amp;#8230; more updates to come.  Currently, I am working on displaying images downloaded from the sheep server given some &lt;a href="http://v2d7b.sheepserver.net/cgi/query.cgi?q=recent_frames&amp;#38;n=50"&gt;set of sheep&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sat, 22 Mar 2008 17:12:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:318597ee-c6d9-4587-9984-18006eb104e0</guid>
      <author>Jessica</author>
      <link>http://www.jessirae.com/blog/articles/2008/03/22/android-sheep</link>
      <category>technology</category>
      <category>logging</category>
      <category>gallery</category>
      <category>imageview</category>
      <category>electricsheep</category>
      <category>android</category>
      <trackback:ping>http://www.jessirae.com/blog/articles/trackback/12743</trackback:ping>
    </item>
  </channel>
</rss>
