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

<channel>
	<title>Warrior Point</title>
	<atom:link href="http://www.warriorpoint.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.warriorpoint.com/blog</link>
	<description>Latest News and Tutorials on Salesforce.com, SaaS, and on-demand software</description>
	<pubDate>Wed, 20 Jul 2011 23:26:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Android Samsung Nexus S: Short Review</title>
		<link>http://www.warriorpoint.com/blog/2011/07/10/android-samsung-nexus-s-short-review/</link>
		<comments>http://www.warriorpoint.com/blog/2011/07/10/android-samsung-nexus-s-short-review/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 03:21:35 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Nexus S]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=422</guid>
		<description><![CDATA[
I&#8217;ve been neglecting the blog for a while.. sorry RSS subscribers.
I bought the HTC Magic 2 years ago when it first came out in Canada. That&#8217;s why most of my blog posts about Android development are from 2 years ago :).
I decided it was time to get the latest and greatest Android phone in Canada: [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_424" class="wp-caption alignleft" style="width: 209px"><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/nexuss.jpg"><img class="size-medium wp-image-424" title="Android Samsung Nexus S" src="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/nexuss-199x300.jpg" alt="Android Samsung Nexus S" width="199" height="300" /></a><p class="wp-caption-text">Android Samsung Nexus S</p></div></p>
<p>I&#8217;ve been neglecting the blog for a while.. sorry RSS subscribers.</p>
<p>I bought the HTC Magic 2 years ago when it first came out in Canada. That&#8217;s why most of my blog posts about Android development are from 2 years ago :).</p>
<p>I decided it was time to get the latest and greatest Android phone in Canada: the <strong>NEXUS S</strong>. A friend currently working at Google on Android highly recommended the device. And the fact that the phone is unlocked, Rogers will not put its apps on it, and Google will push updates directly to the phone without Rogers mandating when, made it even easier to pay the $300. In Canada the phone currently sells for $99 on a brand new contract, but you know how North America works: if you already have a contract you are not as enticing to the carriers as a brand new client with no contract. So, I had to pay a few fees to get the phone for $300 instead of $100.</p>
<p>I won&#8217;t go into a full review of the phone. There are plenty of sites that review the phone and have been doing it since the beginning of the year. I will only review a couple of items that I was worried about and you might be too if you are looking at getting this phone (or just got it).</p>
<p><span id="more-422"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Item 1: Overall</strong></p>
<p>Overall I am extremely happy. The problem with my HTC Magic was that it was getting slower and slower with every update and every app. It was still running Eclair. So many new technological advancements (and apps) have appeared in the past 2 years, I was ready to take them head on with a new phone!</p>
<p>&nbsp;</p>
<p><strong>Item 2: There is no notification light</strong></p>
<p><div id="attachment_425" class="wp-caption alignleft" style="width: 209px"><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/noled.jpg"><img class="size-medium wp-image-425 " title="NoLED App" src="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/noled-199x300.jpg" alt="NoLED App" width="199" height="300" /></a><p class="wp-caption-text">NoLED App</p></div></p>
<p>This is not new; a few of the other Samsung Androids also don&#8217;t have a notification light. I loved seeing the button light up on the HTC Magic but I cannot do that any more. I downloaded an app called NoLED (<a href="http://www.appbrain.com/app/noled/com.led.notify" target="_blank">http://www.appbrain.com/app/noled/com.led.notify</a>). It works quite well. You set it up to monitor apps that would give you notifications, and the app lights up a few pixels (or icons) on your screen when you get a notification. I used it for about a week and then I decided to stop using it. I want to see how difficult it is for me to manually check my phone, without having my phone tell me that I have a notification. But I also stopped using it for 2 other reasons:</p>
<p>- In order for the few pixels to light up, the buttons on the phone light up. The picture on the left is a little blurry, but the top-left of the screen has a red dot lit up and the 4 buttons on the bottom lit up. I don&#8217;t like that the 4 buttons on the bottom light up. There is a Setting in the app to not light these buttons up, but I turned that setting on and, well, you can see they are still lit up. I might be wrong here, but I feel like it wastes my battery when the NoLED app lights up those few buttons- because it is &#8220;waking up&#8221; my phone. I don&#8217;t think it makes such a big difference to battery usage and I recharge my phone nightly regardless, but it bothered me to think that the phone screen was on for extended periods of time.</p>
<p>- To awake the screen and unlock the phone you have to press the physical button on the top-right, however when you get a notification you should NOT press the top-right button. Essentially the NoLED app wakes up your phone, so the screen is now turned on with just a pixel lit up, so if you press the button on the top-right you will turn off the screen, not unlock your phone. It took some time to get used to&#8230; I would see a notification, press the button in the top-right, the screen would turn off, I&#8217;d get pissed off, I would press the button again, the screen would turn on (with the NoLED pixel only), then I would press any of the 4 buttons at the bottom of the phone (e.g. the Home button) which would turn on the screen and allow me to slide the thingy over to unlock it.</p>
<p>Anyways, cool app, try it out. I&#8217;m going to try and see how I can live without a notification light.</p>
<p>&nbsp;</p>
<p><strong>Item 3: There is a weird green bar on the left of the phone</strong></p>
<p><div id="attachment_426" class="wp-caption alignleft" style="width: 209px"><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/greenline.jpg"><img class="size-medium wp-image-426" title="Thin Green Line" src="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/greenline-199x300.jpg" alt="Thin Green Line" width="199" height="300" /></a><p class="wp-caption-text">Thin Green Line</p></div></p>
<p>This scared me. I thought I had a faulty phone and had to return it - right after I got it! But after reading a few things online, it seems like the green line of 1 pixel on the left of the screen has something to do with the AMOLED screen. I tried to take a picture of it here, but I don&#8217;t think you can see much. It only appears if you look closely and only on light backgrounds. <a href="http://androidforums.com/samsung-fascinate/229454-green-line-screen.html" target="_blank">http://androidforums.com/samsung-fascinate/229454-green-line-screen.html</a></p>
<p>&nbsp;</p>
<p><strong>Item 4: Text messaging limit</strong></p>
<p>I had 4000+ text messages on my HTC Magic. Opening the  Messaging app would take 15 seconds every time I wanted to send or read a  message. Eventually I downloaded the app &#8220;Delete Old Messages&#8221;. It took 8 hours to delete 4000 messages. It seems that with Gingerbread, the Android team understood that too many text messages can make the app slow, so now there is a setting in the Messaging app to clean text messages on a regular basis. I plan to use this setting :).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Item 5: Near Field Communication</strong></p>
<p><div id="attachment_427" class="wp-caption alignleft" style="width: 247px"><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/nfc.png"><img class="size-medium wp-image-427" title="NFC!!" src="http://www.warriorpoint.com/blog/wp-content/uploads/2011/07/nfc.png" alt="NFC!!" width="237" height="198" /></a><p class="wp-caption-text">NFC!!</p></div></p>
<p><a href="http://en.wikipedia.org/wiki/Near_field_communication" target="_blank">http://en.wikipedia.org/wiki/Near_field_communication</a>. To quote Steve Jobs, &#8220;This is going to change everything,.. again&#8221;. I love that all phones coming out have NFC readers and the Nexus S is one of the first (here in Canada at least). The technology is not new, and is being used in cellphones in Asia and Europe, but for the laggard Canada it is new and exciting! Soon you&#8217;ll be able to pay just by swiping your phone, and who knows what other uses will appear. Maybe you will be able to check in on FourSquare just by swiping your phone as you walk into a bar, rather than having to press anything on your screen.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>And conclusion</strong></p>
<p>That&#8217;s it for now. Great phone, I highly recommend it. I think I&#8217;m going to start playing with NFC now. Some links for other NFC enthusiasts:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/4417911/where-can-i-buy-nfc-tags" target="_blank">http://stackoverflow.com/questions/4417911/where-can-i-buy-nfc-tags</a></li>
<li><a href="http://www.tagstand.com/" target="_blank">http://www.tagstand.com/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2011/07/10/android-samsung-nexus-s-short-review/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Windows Phone 7: Beginner’s Guide to Developing on Windows Phone 7</title>
		<link>http://www.warriorpoint.com/blog/2010/09/26/windows-phone-7-beginner%e2%80%99s-guide-to-developing-on-windows-phone-7/</link>
		<comments>http://www.warriorpoint.com/blog/2010/09/26/windows-phone-7-beginner%e2%80%99s-guide-to-developing-on-windows-phone-7/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 20:05:56 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=396</guid>
		<description><![CDATA[
The official release date for Windows Phone 7 is October 11th (in the US). Word around the internet is that it will be released in Canada around the end of October / beginning of November. LG, Samsung, HTC, and Dell have all developed handsets that will be available in Canada. One of the services we [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-397" title="iheartwp7" src="http://www.warriorpoint.com/blog/wp-content/uploads/2010/09/iheartwp7.png" alt="IHeartWP7" width="250" height="250" /></p>
<p>The official release date for Windows Phone 7 is October 11th (in the US). Word around the internet is that it will be released in Canada around the end of October / beginning of November. LG, Samsung, HTC, and Dell have all developed handsets that will be available in Canada. One of the services we offer at <a href="http://www.imason.com">my place of employment</a> is mobile development and since we are a Microsoft Gold Partner, developing on Windows Phone 7 is our forte (actually it’s the only mobile development we do). I assume as this platform gets bigger more people will jump to learn how to program on it, so this is a quick-and-dirty list of resources that will help you to learn about programming on Windows Phone 7.</p>
<ol>
<li><a href="http://developer.windowsphone.com/" target="_blank">http://developer.windowsphone.com/</a><br />
If you are a developer, the first thing you need to do is visit the developer’s home page. You can download tools from here, read about the SDK, look at sample code, and get questions answered in the forums.</li>
<li><a href="http://silverlight.codeplex.com/releases" target="_blank">http://silverlight.codeplex.com/releases</a><br />
You must download the Silverlight Toolkit for Windows Phone 7. It has alot of great Silverlight controls that will make your app much cooler. For example, the version of the SDK and Silverlight that you get from the first link does not have a calendar control. The Toolkit from this link has a DatePicker and a TimePicker control that you can just plop on your page and use.</li>
<li><a href="http://channel9.msdn.com/Learn/Courses/WP7TrainingKit" target="_blank">http://channel9.msdn.com/Learn/Courses/WP7TrainingKit</a><br />
The best place I have found for guides, best practices, code samples, etc was Channel9. This is the home page.</li>
<li><a href="http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight" target="_blank">http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight</a><br />
I particularly like the home page for Silverlight on WP7. There are a ton of tutorials here, the ones I found most useful are listed below.</li>
<li><a href="http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/WindowsPhoneNavigationAndControlsLab" target="_blank">http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/WindowsPhoneNavigationAndControlsLab</a><br />
How to handle navigation, going back and forth between pages, the best practices for setting up your pages.</li>
<li><a href="http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/ApplicationLifetimeWP7Lab" target="_blank">http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/ApplicationLifetimeWP7Lab</a><br />
Very important read on the application life cycle of a WP7 app.</li>
<li><a href="http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/LaunchersAndChoosersWP7Lab" target="_blank">http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/LaunchersAndChoosersWP7Lab<br />
</a>Working with launchers and choosers. Launchers and choosers are parts ofthe API that allow you interact with the Windows Phone 7 first-partyapps, such as the email client, calendar/agenda, contact list, messaging app, etc.</li>
<li><a href="http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/UsingPivotAndPanoramaControls" target="_blank">http://channel9.msdn.com/Learn/Courses/WP7TrainingKit/WP7Silverlight/UsingPivotAndPanoramaControls<br />
</a>This tutorial shows you how to make your apps have the cool Windows Phone 7 feel with the sliding between screens (called pivot and panorama controls).</li>
<li><a href="http://www.silverlight.net/learn/videos/all/windows-phone-application-bar/" target="_blank">http://www.silverlight.net/learn/videos/all/windows-phone-application-bar/<br />
</a>Great tutorial video on how to set up the application bar at the bottom of your app. The video also shows the different customizations that you can do to the application bar.</li>
<li><a href="http://channel9.msdn.com/Blogs/SlickThought/Simplify-Page-Transitions-in-Windows-Phone-7-Silverlight-Applications" target="_blank">http://channel9.msdn.com/Blogs/SlickThought/Simplify-Page-Transitions-in-Windows-Phone-7-Silverlight-Applications<br />
</a>Getting the cool fade-in, fade-out page transitions to work. This effect is done by using the TransitioningContentControl that comes with the Silverlight toolkit (an extra install from link #2). Note: this tutorial was done on the April release of the Windows Phone 7 SDK, the latest SDK is slightly different.</li>
<li><a href="http://channel9.msdn.com/blogs/slickthought/custom-per-page-transitions-for-windows-phone-7" target="_blank"><span id="more-396"></span>http://channel9.msdn.com/blogs/slickthought/custom-per-page-transitions-for-windows-phone-7<br />
</a>Similar to the previous link, this shows a little bit more about fancy, animated page transitions.</li>
<li><a href="http://blogs.msdn.com/b/avip/archive/2010/04/03/windows-phone-frame-page-navigation-and-transitions-using-the-transitioningcontentcontrol.aspx" target="_blank">http://blogs.msdn.com/b/avip/archive/2010/04/03/windows-phone-frame-page-navigation-and-transitions-using-the-transitioningcontentcontrol.aspx<br />
</a>This is another link on page transitions by using the TransitioningContentControl. However, it also uses the April release.</li>
<li><a href="http://www.viddler.com/explore/pagebrooks/videos/10/" target="_blank">http://www.viddler.com/explore/pagebrooks/videos/10/<br />
</a>This video tutorial describes how to create a splash screen for you Windows Phone 7 application. It’s quite simple actually.</li>
<li><a href="http://mobileworld.appamundi.com/blogs/andywigley/archive/2010/07/12/migrating-wp7-april-ctp-projects-to-wp7-beta.aspx" target="_blank">http://mobileworld.appamundi.com/blogs/andywigley/archive/2010/07/12/migrating-wp7-april-ctp-projects-to-wp7-beta.aspx<br />
</a>There are differences between the April CTP release and the July release of the Windows Phone 7 SDK. This blog post describes a couple of steps to convert older projects to the new version. Obviously if you are just starting out you do not need this, but if you find sample code on the internet, you might need these steps to get the code working on your machine.</li>
</ol>
<p>If you are just starting out, then these links (and probably a couple of days of your time) will be sufficient to introduce you into the structure, framework, best practices, and common utilities for Windows Phone 7. And now I’m off to try and get my own TransitioningContentControl to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2010/09/26/windows-phone-7-beginner%e2%80%99s-guide-to-developing-on-windows-phone-7/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Samsung may drop Windows Mobile and switch to Android</title>
		<link>http://www.warriorpoint.com/blog/2009/11/10/samsung-may-drop-windows-mobile-and-switch-to-android/</link>
		<comments>http://www.warriorpoint.com/blog/2009/11/10/samsung-may-drop-windows-mobile-and-switch-to-android/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 03:36:52 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=388</guid>
		<description><![CDATA[I just found this article from reddit&#8230;
Samsung may drop Windows Mobile for Android
Apparently Samsung is going to stop using Windows Mobile on its cellphones and will concentrate on Android!! I have been a supporter of Android since its inception and stories like these bring tears of joy to my eyes.
Oh, and there&#8217;s something about Samsung [...]]]></description>
			<content:encoded><![CDATA[<p>I just found this article from reddit&#8230;<br />
<a href="http://www.wiseandroid.com/NewsItem.aspx?category=News&amp;path=November&amp;itemid=16" target="_blank">Samsung may drop Windows Mobile for Android</a></p>
<p>Apparently Samsung is going to stop using Windows Mobile on its cellphones and will concentrate on Android!! I have been a supporter of Android since its inception and stories like these bring tears of joy to my eyes.</p>
<p>Oh, and there&#8217;s something about Samsung rolling out their own open source OS called &#8220;Bada&#8221;. Good for them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/11/10/samsung-may-drop-windows-mobile-and-switch-to-android/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: Simplified source code for parsing and working with XML data and web services in Android</title>
		<link>http://www.warriorpoint.com/blog/2009/07/19/android-simplified-source-code-for-parsing-and-working-with-xml-data-and-web-services-in-android/</link>
		<comments>http://www.warriorpoint.com/blog/2009/07/19/android-simplified-source-code-for-parsing-and-working-with-xml-data-and-web-services-in-android/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 02:05:24 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=378</guid>
		<description><![CDATA[In my previous post I linked to a terrific website (Working with XML on Android) which describes how you can read and parse XML documents in Android. The code supplied by that website used polymorphism to show 4 different methods for parsing the XML data. I vowed to simplify that and share the new source [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.warriorpoint.com/blog/2009/07/19/android-reading-using-and-working-with-xml-data-and-web-services-in-android/" target="_blank">previous post</a> I linked to a terrific website (<a title="http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82Android-XML&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw82" href="http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82Android-XML&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw82" target="_blank">Working with XML on Android</a>) which describes how you can read and parse XML documents in Android. The code supplied by that website used polymorphism to show 4 different methods for parsing the XML data. I vowed to simplify that and share the new source code.</p>
<p>To <a href="http://www.warriorpoint.com/blog/downloads/" target="_blank">download the AndroidXmlSimple project click here</a>. You will be taken to another page where you can click to download to the ZIP file.</p>
<p>Below are some instructions on setting yourself up with this source code and customizing it for your own XML data.</p>
<p> <span id="more-378"></span>
<p>1. Download the file AndroidXmlSimple.zip</p>
<p>2. Unzip it on your disk.</p>
<p>3. Open Eclipse and import the Android project into your workspace.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/01import1.jpg"><img title="01 Import" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="456" alt="01 Import" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/01import-thumb1.jpg" width="388" border="0" /></a> </p>
<p>4. The project will look like this:</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/02project1.jpg"><img title="02 project" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="440" alt="02 project" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/02project-thumb1.jpg" width="391" border="0" /></a> </p>
<p>5. This new project opens up an XML document (the same RSS feed as the original example) and displays it using a ListActivity.</p>
<p>6. The classes are:</p>
<p>- MessageList.java: the main Activity</p>
<p>- Message.java: object that stores the parsed XML data</p>
<p>- RssHandler.java: object that parses the XML data</p>
<p>- BaseFeedParser.java: object that initiates the starting point and configurations for the XML data that should be parsed. </p>
<p>7. To customize this project for your own feed, edit the file BaseFeedParser.java.</p>
<p>Update the URL location here:</p>
<pre class="csharpcode" style="width: 69.26%; height: 45px"><span class="kwrd">static</span> String feedUrlString = <span class="str">&quot;http://www.androidster.com/android_news.rss&quot;</span>;</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Update the hierarchy of nodes here:</p>
<pre class="csharpcode" style="width: 64.36%; height: 75px"><span class="kwrd">static</span> final String RSS = <span class="str">&quot;rss&quot;</span>;
<span class="kwrd">static</span> final String CHANNEL = <span class="str">&quot;channel&quot;</span>;
<span class="kwrd">static</span> final String ITEM = <span class="str">&quot;item&quot;</span>;</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Update the node names that repeat here:</p>
<pre class="csharpcode" style="width: 65.33%; height: 98px"><span class="kwrd">static</span> final String PUB_DATE = <span class="str">&quot;pubDate&quot;</span>;
<span class="kwrd">static</span> final String DESCRIPTION = <span class="str">&quot;description&quot;</span>;
<span class="kwrd">static</span> final String LINK = <span class="str">&quot;link&quot;</span>;
<span class="kwrd">static</span> final String TITLE = <span class="str">&quot;title&quot;</span>;</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>And as in the previous post, if you change any names of the constants, you will need to update other sections of the code-base, for example below in BaseFeedParser.java, and in a few places in RssHandler.java.</p>
<pre class="csharpcode" style="width: 68.29%; height: 372px">        item.getChild(TITLE).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setTitle(body);
            }
        });
        item.getChild(LINK).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setLink(body);
            }
        });
        item.getChild(DESCRIPTION).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setDescription(body);
            }
        });
        item.getChild(PUB_DATE).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setDate(body);
            }
        });</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<p>Please leave a comment if you download this ZIP file – I’d like to know if you found this useful. And let me know if it does what you expected after reading my post. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/07/19/android-simplified-source-code-for-parsing-and-working-with-xml-data-and-web-services-in-android/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: Reading, using and working with XML data and web services in Android</title>
		<link>http://www.warriorpoint.com/blog/2009/07/19/android-reading-using-and-working-with-xml-data-and-web-services-in-android/</link>
		<comments>http://www.warriorpoint.com/blog/2009/07/19/android-reading-using-and-working-with-xml-data-and-web-services-in-android/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 00:37:33 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=363</guid>
		<description><![CDATA[One of the most powerful aspects of any mobile application for a 3G phone is that it can connect to the Internet. By connecting to the Internet the application can offer much more value to the user since it becomes an interface for a web-based component, e.g. using Twitter’s API to create a Twitter application [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most powerful aspects of any mobile application for a 3G phone is that it can connect to the Internet. By connecting to the Internet the application can offer much more value to the user since it becomes an interface for a web-based component, e.g. using Twitter’s API to create a Twitter application so that you can get your Twitter updates without having to open the mobile browser. The most common way of interfacing with a web-based component is by using web services in XML format.</p>
<p>While trying to developer my own app which reads a web service from my own server, I ran into a lot of difficulties in implementing the client that consumes the web service. Android does not have libraries for XPath handling of XML documents, so it makes deciphering XML data a little bit more difficult. From what I’ve read online the Android team is currently working on including such libraries in future versions.</p>
<p>After some digging around I found an amazing link that shows different methods for consuming an XML file in Android and parsing through it without the use of XPaths. The link is this: <a title="http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82Android-XML&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw82" href="http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82Android-XML&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw82" target="_blank">Working with XML on Android</a>. To start off, this link is an absolute must-read. Everything that I am going to write in my post here relates to this link. The code offered on that webpage uses polymorphism to show you 4 different methods of working with XML data. It provides a fully-functional Android application and all the source code for it. The source code can be found here: <a title="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=398121&amp;filename=AndroidXml.zip&amp;method=http&amp;locale=worldwide" href="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=398121&amp;filename=AndroidXml.zip&amp;method=http&amp;locale=worldwide">AndroidXML.zip</a>.</p>
<p>My post today will concentrate on how to customize the code from the application in the above link, in order to read and parse your own XML data. If you are a Java pro, you might not need this post. My Java is a little rusty, so I needed some time to figure out exactly what I had to change and where in order to get this to work with my own web service XML. Now that I’ve figured it out, I thought I’d share it. In my next post I will give the simplified version of this code – where there is no polymorphism, and thus there are only the minimum number of classes needed to implement this XML-reading solution. I can’t offer this simplified code right now – because I haven’t coded it yet :).</p>
<p>So until I post the simplified source code for working with XML data in Android, here are some tips on getting through the larger polymorphism-based source code and customizing it for your own XML data:</p>
<p><span id="more-363"></span></p>
<p>1. First off, read over the link <a title="http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82Android-XML&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw82" href="http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82Android-XML&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw82" target="_blank">Working with XML on Android</a> as much as you can.</p>
<p>2. Download the source code for the Android application that they offer: <a title="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=398121&amp;filename=AndroidXml.zip&amp;method=http&amp;locale=worldwide" href="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=398121&amp;filename=AndroidXml.zip&amp;method=http&amp;locale=worldwide">AndroidXML.zip</a>.</p>
<p>3. Import the project into your Eclipse workspace by right-clicking in Project Explorer and selecting “Import”.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/01import.jpg"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="01 Import" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/01import-thumb.jpg" border="0" alt="01 Import" width="426" height="502" /></a></p>
<p>4. Select “Existing Projects into Workspace”</p>
<p>5. Browse to the directory where you extracted the ZIP file with the source code and then click on the Next buttons to finish off the wizard. The project is called “AndroidXml”.</p>
<p>6. You will now see the project in your workspace:</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/02project.jpg"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="02 project" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/02project-thumb.jpg" border="0" alt="02 project" width="370" height="533" /></a></p>
<p>7. Here is a quick breakdown of what some of those Java classes do:</p>
<p>- MessageList.java is the main activity that gets started. It lists the items from the XML data using a ListActivity. In this project the items come from an RSS feed.</p>
<p>- FeedParser.java, FeedParserFactory.java, BaseFeedParser.java, RSSHandler.hava are all classes that this particular example uses to set the framework for polymorphism.</p>
<p>- This example uses 4 methods for grabbing the XML data and reading it.The 4 methods that this example uses are:</p>
<blockquote><p>1. AndroidSaxFeedParser.java (the default)</p>
<p>2. DomFeedParser.java</p>
<p>3. SaxFeedParser.java</p>
<p>4. XmlPullFeedParser.java</p></blockquote>
<p>These 4 classes all extend BaseFeedParser.java.</p>
<p>8. In order to customize this for your own XML file you need to edit the following places (assuming you are using AndroidSaxFeedParser, which is the default):</p>
<p>- FeedParserFactory.java: you need to change the URL location of the web service or XML document in the global variable here:</p>
<pre class="csharpcode" style="width: 65.22%; height: 29px;"><span class="kwrd">static</span> String feedUrl = <span class="str">"http://www.androidster.com/android_news.rss"</span>;</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>- AndroidSaxFeedParser.java: you need to change the root node of your XML document. This is stored in the String called RSS.</p>
<pre class="csharpcode" style="width: 65.05%; height: 30px;"><span class="kwrd">static</span> final String RSS = <span class="str">"RootNode"</span>;</pre>
<p>- BaseFeedParser.java: you need to change this class according to the nodes that your XML document has.</p>
<p>The nodes CHANNEL and ITEM refer to the nodes &lt;Channel&gt; and &lt;Item&gt; in the RSS feed that this example uses. You need to change them to mimic your nodes from your XML document:</p>
<pre class="csharpcode" style="width: 65%; height: 43px;"><span class="kwrd">static</span> final String CHANNEL = <span class="str">"channel"</span>;
<span class="kwrd">static</span> final  String ITEM = <span class="str">"item"</span>;</pre>
<p>The other constants that are declared refer to the nodes for each repeating item.<br />
<!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<pre class="csharpcode" style="width: 65.28%; height: 83px;"><span class="kwrd">static</span> final  String PUB_DATE = <span class="str">"pubDate"</span>;
<span class="kwrd">static</span> final  String DESCRIPTION = <span class="str">"description"</span>;
<span class="kwrd">static</span> final  String LINK = <span class="str">"link"</span>;
<span class="kwrd">static</span> final  String TITLE = <span class="str">"title"</span>;</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --> <!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>For this particular example, since an RSS feed XML document is used, it has repeating nodes for &lt;Description&gt;, &lt;Link&gt;, &lt;Title&gt;, &lt;PubDate&gt;. You need to change this structure to mimic your structure.</p>
<p>Note: Remember that if you change the name of the constants (as opposed to the value of the constants), you will need to change other classes which call these constants.<br />
<!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>- If you change the names of the constants, you will have to update AndroidSaxFeedParser.java in this section:</p>
<pre class="csharpcode" style="width: 67.45%; height: 343px;">        item.getChild(TITLE).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setTitle(body);
            }
        });
        item.getChild(LINK).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setLink(body);
            }
        });
        item.getChild(DESCRIPTION).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setDescription(body);
            }
        });
        item.getChild(PUB_DATE).setEndTextElementListener(<span class="kwrd">new</span> EndTextElementListener(){
            <span class="kwrd">public</span> <span class="kwrd">void</span> end(String body) {
                currentMessage.setDate(body);
            }
        });</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>As you can see this section is hardcoded for the 4 nodes that are expected in this XML document (TITLE, LINK, DESCRIPTION, PUB_DATE). You will need to change this section and hardcode this for your own nodes.</p>
<p>- If you change the names of the higher-level nodes, i.e. &lt;Channel&gt; and &lt;Item&gt;, then you need to update the following section of AndroidSaxFeedParser.java:</p>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<pre class="csharpcode" style="width: 65.08%; height: 49px;">Element itemlist = root.getChild(CHANNEL);
Element item = itemlist.getChild(ITEM);</pre>
<p>And that is all. The customized code will use the AndroidSaxParser implementation of an XML Parser, it will go to the URL you provided in FeedParserFactory.java, and it will iterate through the updated nodes as you have labeled them in BaseFeedParser.java and AndroidSaxFeedParser.java.</p>
<p>In my next post I will provide a simplified version of this code, which does not use polymorphism. It will (hopefully) use the minimum required classes to get XML data and parse it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/07/19/android-reading-using-and-working-with-xml-data-and-web-services-in-android/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: Creating TableRow rows inside a TableLayout programatically</title>
		<link>http://www.warriorpoint.com/blog/2009/07/01/android-creating-tablerow-rows-inside-a-tablelayout-programatically/</link>
		<comments>http://www.warriorpoint.com/blog/2009/07/01/android-creating-tablerow-rows-inside-a-tablelayout-programatically/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 02:07:39 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=353</guid>
		<description><![CDATA[In my quest to create a “Taxman” Android application I ran into the following problem:
I want to ask the user to enter their yearly income, after which the screen will flip and their after-tax income will be displayed in a table format for all Canadian provinces. (And for the future: all US states). The problem [...]]]></description>
			<content:encoded><![CDATA[<p>In my quest to create a “Taxman” Android application I ran into the following problem:</p>
<p>I want to ask the user to enter their yearly income, after which the screen will flip and their after-tax income will be displayed in a table format for all Canadian provinces. (And for the future: all US states). The problem I ran into is creating a TableRow for each Canadian province in my main.xml. There are 13 provinces and territories, so 13 is not that bad to copy &amp; paste in the main.xml; however, as soon as I have to copy &amp; paste more than 2 times I start cringing and nausea kicks in. Personally I think “copy &amp; paste” should not be in the programming vocabulary. Not only that, but I have 13 provinces now, what about when I have to enter 50 states! So, I had to find a way to create these new TableRow rows programmatically inside my TableLayout layout.</p>
<p>A great source for code snippets and answers to Android questions is <a title="http://www.anddev.org" href="http://www.anddev.org">http://www.anddev.org</a>. I’m sure if you’re dabbling with Android then you’ve already come across this site. The particular post I read to do this is this one: <a title="http://www.anddev.org/viewtopic.php?p=3404" href="http://www.anddev.org/viewtopic.php?p=3404" target="_blank">Dynamically add rows to TableLayout</a>. Commenters on that post were having problems getting this to work, but after I imported all the correct classes (android.widget.TableRow.LayoutParams is an important one to use) everything worked from the first time. I forced Eclipse to find most of the classes for me.</p>
<p>Below is the code from anddev.org, with my changes for my Taxman Android app. I’m too lazy to do a full-out beginning-to-end tutorial for this code snippet.</p>
<p>First I set my constants at the top of the Activity class:</p>
<pre class="csharpcode" style="width: 65.27%; height: 273px;"><span class="kwrd">public</span> <span class="kwrd">class</span> Activity1 extends Activity implements OnTouchListener{

    <span class="kwrd">int</span> PROVINCE_Alberta = 0;
    <span class="kwrd">int</span> PROVINCE_BC = 1;
    <span class="kwrd">int</span> PROVINCE_Manitoba = 2;
    <span class="kwrd">int</span> PROVINCE_NewBrunswick = 3;
    <span class="kwrd">int</span> PROVINCE_Newfoundland = 4;
    <span class="kwrd">int</span> PROVINCE_Northwest = 5;
    <span class="kwrd">int</span> PROVINCE_NovaScotia = 6;
    <span class="kwrd">int</span> PROVINCE_Nunavut = 7;
    <span class="kwrd">int</span> PROVINCE_Ontario = 8;
    <span class="kwrd">int</span> PROVINCE_PEI = 9;
    <span class="kwrd">int</span> PROVINCE_Quebec = 10;
    <span class="kwrd">int</span> PROVINCE_Saskatchewan = 11;
    <span class="kwrd">int</span> PROVINCE_Yukon = 12;

    <span class="kwrd">int</span> numProvinces = 13;</pre>
<p><span id="more-353"></span></p>
<p>There are 13 of them this time, there will be 50 of them for the States… technically this could be made into something much more malleable like an external config-type XML file.</p>
<p>Then in the onCreate method I created an array of String objects that will house all these provinces:</p>
<pre class="csharpcode" style="width: 65.25%; height: 225px;">        String[] provinces = <span class="kwrd">new</span> String[numProvinces];
        provinces[PROVINCE_Alberta] = <span class="str">"Alberta"</span>;
        provinces[PROVINCE_BC] = <span class="str">"British Columbia"</span>;
        provinces[PROVINCE_Manitoba] = <span class="str">"Manitoba"</span>;
        provinces[PROVINCE_NewBrunswick] = <span class="str">"New Brunswick"</span>;
        provinces[PROVINCE_Newfoundland] = <span class="str">"Newfoundland and Labrador"</span>;
        provinces[PROVINCE_Northwest] = <span class="str">"Northwest Territories"</span>;
        provinces[PROVINCE_NovaScotia] = <span class="str">"Nova Scotia"</span>;
        provinces[PROVINCE_Nunavut] = <span class="str">"Nunavut"</span>;
        provinces[PROVINCE_Ontario] = <span class="str">"Ontario"</span>;
        provinces[PROVINCE_PEI] = <span class="str">"Prince Edward Island"</span>;
        provinces[PROVINCE_Quebec] = <span class="str">"Quebec"</span>;
        provinces[PROVINCE_Saskatchewan] = <span class="str">"Saskatchewan"</span>;
        provinces[PROVINCE_Yukon] =  <span class="str">"Yukon"</span>;</pre>
<p>And right underneath that I create a TableRow for each item in the array provinces:</p>
<pre class="csharpcode" style="width: 65.42%; height: 609px;">        <span class="rem">// Get the TableLayout</span>
        TableLayout tl = (TableLayout) findViewById(R.id.maintable);

        <span class="rem">// Go through each item in the array</span>
        <span class="kwrd">for</span> (<span class="kwrd">int</span> current = 0; current &lt; numProvinces; current++)
        {
            <span class="rem">// Create a TableRow and give it an ID</span>
            TableRow tr = <span class="kwrd">new</span> TableRow(<span class="kwrd">this</span>);
            tr.setId(100+current);
            tr.setLayoutParams(<span class="kwrd">new</span> LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));   

            <span class="rem">// Create a TextView to house the name of the province</span>
            TextView labelTV = <span class="kwrd">new</span> TextView(<span class="kwrd">this</span>);
            labelTV.setId(200+current);
            labelTV.setText(provinces[current]);
            labelTV.setTextColor(Color.BLACK);
            labelTV.setLayoutParams(<span class="kwrd">new</span> LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));
            tr.addView(labelTV);

            <span class="rem">// Create a TextView to house the value of the after-tax income</span>
            TextView valueTV = <span class="kwrd">new</span> TextView(<span class="kwrd">this</span>);
            valueTV.setId(current);
            valueTV.setText(<span class="str">"$0"</span>);
            valueTV.setTextColor(Color.BLACK);
            valueTV.setLayoutParams(<span class="kwrd">new</span> LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));
            tr.addView(valueTV);

            <span class="rem">// Add the TableRow to the TableLayout</span>
            tl.addView(tr, <span class="kwrd">new</span> TableLayout.LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));
        }</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --> <!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>The main.xml contains the following for the TableLayout:</p>
<pre class="csharpcode" style="width: 65.56%; height: 121px;">        &lt;TableLayout xmlns:android=<span class="str">"http://schemas.android.com/apk/res/android"</span>
                android:layout_width=<span class="str">"fill_parent"</span>
                android:layout_height=<span class="str">"fill_parent"</span>
                android:stretchColumns=<span class="str">"0,1"</span>
                android:id=<span class="str">"@+id/maintable"</span> &gt;
        &lt;/TableLayout&gt;</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>And here is the final result:</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/image.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/07/image-thumb.png" border="0" alt="image" width="328" height="625" /></a></p>
<p>So far I have the Ontario taxes working :). If you make $50,000 in Ontario, you’d be taking home $38,285.53.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/07/01/android-creating-tablerow-rows-inside-a-tablelayout-programatically/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: Switching screens by dragging over the touch screen</title>
		<link>http://www.warriorpoint.com/blog/2009/05/29/android-switching-screens-by-dragging-over-the-touch-screen/</link>
		<comments>http://www.warriorpoint.com/blog/2009/05/29/android-switching-screens-by-dragging-over-the-touch-screen/#comments</comments>
		<pubDate>Fri, 29 May 2009 04:17:03 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=345</guid>
		<description><![CDATA[In this post I will show you how to use the touch screen so that you can drag your finger across the screen, and it will switch the screen for you – “iPhone style”!
For this I will be implemented OnTouchListener and overrided the method OnTouch().
To start off, we need to create an Activity with two [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will show you how to use the touch screen so that you can drag your finger across the screen, and it will switch the screen for you – “iPhone style”!</p>
<p>For this I will be implemented OnTouchListener and overrided the method OnTouch().</p>
<p>To start off, we need to create an Activity with two screens. The two screens will be implemented using a ViewFlipper in the main.xml layout file. Follow the steps in this blog post to set yourself up: <a href="http://www.warriorpoint.com/blog/2009/05/26/android-switching-screens-in-an-activity-with-animations-using-viewflipper/">Android: Switching screens in an Activity with animations (using ViewFlipper)</a>.</p>
<p>1. Now that you have yourself set up, open the Activity1 class.</p>
<p>2. Make the class implement OnTouchListener. The top of the class will look like this:</p>
<pre class="csharpcode" style="width: 65.35%; height: 81px;">...
import android.view.View.OnTouchListener;

<span class="kwrd">public</span> <span class="kwrd">class</span> Activity1 extends Activity implements OnTouchListener{
...</pre>
<p>2. You will have to override the OnTouch() method as well. If you were using eclipse, it might have created the method stub for you:</p>
<pre class="csharpcode" style="width: 65.37%; height: 81px;">    @Override
    <span class="kwrd">public</span> boolean onTouch(View arg0, MotionEvent arg1) {
        <span class="rem">// TODO Auto-generated method stub</span>
        <span class="kwrd">return</span> <span class="kwrd">false</span>;
    }</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>Here is the method that you need to use instead:</p>
<pre class="csharpcode" style="width: 65.43%; height: 471px;">    <span class="kwrd">public</span> boolean onTouch(View arg0, MotionEvent arg1) {

        <span class="rem">// Get the action that was done on this touch event</span>
        <span class="kwrd">switch</span> (arg1.getAction())
        {
            <span class="kwrd">case</span> MotionEvent.ACTION_DOWN:
            {
                <span class="rem">// store the X value when the user's finger was pressed down</span>
                downXValue = arg1.getX();
                <span class="kwrd">break</span>;
            }

            <span class="kwrd">case</span> MotionEvent.ACTION_UP:
            {
                <span class="rem">// Get the X value when the user released his/her finger</span>
                <span class="kwrd">float</span> currentX = arg1.getX();            

                <span class="rem">// going backwards: pushing stuff to the right</span>
                <span class="kwrd">if</span> (downXValue &lt; currentX)
                {
                    <span class="rem">// Get a reference to the ViewFlipper</span>
                     ViewFlipper vf = (ViewFlipper) findViewById(R.id.details);
                     <span class="rem">// Set the animation</span>
                      vf.setAnimation(AnimationUtils.loadAnimation(<span class="kwrd">this</span>, R.anim.push_left_out));
                      <span class="rem">// Flip!</span>
                      vf.showPrevious();
                }

                <span class="rem">// going forwards: pushing stuff to the left</span>
                <span class="kwrd">if</span> (downXValue &gt; currentX)
                {
                    <span class="rem">// Get a reference to the ViewFlipper</span>
                    ViewFlipper vf = (ViewFlipper) findViewById(R.id.details);
                     <span class="rem">// Set the animation</span>
                     vf.setInAnimation(AnimationUtils.loadAnimation(<span class="kwrd">this</span>, R.anim.push_left_in));
                      <span class="rem">// Flip!</span>
                     vf.showNext();
                }
                <span class="kwrd">break</span>;
            }
        }

        <span class="rem">// if you return false, these actions will not be recorded</span>
        <span class="kwrd">return</span> <span class="kwrd">true</span>;
    }</pre>
<p>What I’ve done is added a CASE statement. On press down of the finger we save the current X value. On press up of the finger, after the dragging motion has finished, I check the X value again. I compare the two X values and I make a logical decision whether I should switch the screens forwards or backwards.<br />
<!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p><span id="more-345"></span></p>
<p>3. For the above to work, you need to add a global variable called downXValue that will store the X value when the finger was pressed down. Add the line below at the top of the class:</p>
<pre class="csharpcode" style="width: 65.33%; height: 145px;">...
<span class="kwrd">public</span> <span class="kwrd">class</span> Activity1 extends Activity implements OnTouchListener{

    <span class="kwrd">private</span> <span class="kwrd">float</span> downXValue;

    <span class="rem">/** Called when the activity is first created. */</span>
    @Override
    <span class="kwrd">public</span> <span class="kwrd">void</span> onCreate(Bundle savedInstanceState) {
...</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>4. Now, you we will edit the main.xml layout. This is different from the main.xml from the previous post in two ways:</p>
<ul>
<li>The two buttons that switched the views have been removed, because we don’t need them anymore and</li>
<li>I added an ID to the main LinearLayout so that I may reference it in my code.</li>
</ul>
<p>Here is the entire main.xml:</p>
<pre class="csharpcode" style="width: 65.41%; height: 535px;">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span>?&gt;
&lt;LinearLayout xmlns:android=<span class="str">"http://schemas.android.com/apk/res/android"</span>
    android:orientation=<span class="str">"vertical"</span>
    android:layout_width=<span class="str">"fill_parent"</span>
    android:layout_height=<span class="str">"fill_parent"</span>
    android:background=<span class="str">"#ffffff"</span>
    android:id=<span class="str">"@+id/layout_main"</span>
    &gt;

    &lt;ViewFlipper android:id=<span class="str">"@+id/details"</span>
        android:layout_width=<span class="str">"fill_parent"</span>
        android:layout_height=<span class="str">"fill_parent"</span>&gt;  

        &lt;LinearLayout
               android:orientation=<span class="str">"vertical"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"fill_parent"</span>
            android:background=<span class="str">"#ffffff"</span>&gt;

            &lt;TextView android:id=<span class="str">"@+id/tv_country"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"wrap_content"</span>
            android:textColor=<span class="str">"#000000"</span>
            android:textStyle=<span class="str">"bold"</span>
            android:textSize=<span class="str">"18px"</span>
            android:text=<span class="str">"Country"</span> &gt;
            &lt;/TextView&gt;
            &lt;Spinner android:text=<span class="str">""</span>
            android:id=<span class="str">"@+id/spinner_country"</span>
            android:layout_width=<span class="str">"200px"</span>
            android:layout_height=<span class="str">"55px"</span>&gt;
            &lt;/Spinner&gt;
        &lt;/LinearLayout&gt; 

        &lt;LinearLayout
               android:orientation=<span class="str">"vertical"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"fill_parent"</span>
            android:background=<span class="str">"#ffffff"</span>&gt;

            &lt;TextView android:id=<span class="str">"@+id/tv_income"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"wrap_content"</span>
            android:textColor=<span class="str">"#000000"</span>
            android:textStyle=<span class="str">"bold"</span>
            android:textSize=<span class="str">"18px"</span>
            android:text=<span class="str">"Income"</span> &gt;
            &lt;/TextView&gt;
            &lt;EditText android:text=<span class="str">""</span>
            android:id=<span class="str">"@+id/et_income"</span>
            android:layout_width=<span class="str">"200px"</span>
            android:layout_height=<span class="str">"55px"</span>&gt;
            &lt;/EditText&gt;
        &lt;/LinearLayout&gt; 

    &lt;/ViewFlipper&gt;

&lt;/LinearLayout&gt;</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>5. We will have to add a listener for the OnTouch() event in the OnCreate() method of the Activity1 class will be. Add the following two lines:</p>
<pre class="csharpcode" style="width: 65.38%; height: 177px;">...
    <span class="kwrd">public</span> <span class="kwrd">void</span> onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        <span class="rem">// Set main.XML as the layout for this Activity</span>
        setContentView(R.layout.main);

        <span class="rem">// Add these two lines</span>
        LinearLayout layMain = (LinearLayout) findViewById(R.id.layout_main);
        layMain.setOnTouchListener((OnTouchListener) <span class="kwrd">this</span>);
...</pre>
<p>6. You should also remove the two Button OnClick() events and listeners, because those buttons do not exist anymore. Here is the final version of the Activity1.java class:</p>
<pre class="csharpcode" style="width: 65.64%; height: 727px;">package com.warriorpoint.taxman3;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.AnimationUtils;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.ViewFlipper;

<span class="kwrd">public</span> <span class="kwrd">class</span> Activity1 extends Activity implements OnTouchListener{

    <span class="kwrd">float</span> downXValue;

    <span class="rem">/** Called when the activity is first created. */</span>
    @Override
    <span class="kwrd">public</span> <span class="kwrd">void</span> onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        <span class="rem">// Set main.XML as the layout for this Activity</span>
        setContentView(R.layout.main);

        <span class="rem">// Add these two lines</span>
        LinearLayout layMain = (LinearLayout) findViewById(R.id.layout_main);
        layMain.setOnTouchListener((OnTouchListener) <span class="kwrd">this</span>); 

        <span class="rem">// Add a few countries to the spinner</span>
        Spinner spinnerCountries = (Spinner) findViewById(R.id.spinner_country);
        ArrayAdapter countryArrayAdapter = <span class="kwrd">new</span> ArrayAdapter(<span class="kwrd">this</span>,
                    android.R.layout.simple_spinner_dropdown_item,
                    <span class="kwrd">new</span> String[] { <span class="str">"Canada"</span>, <span class="str">"USA"</span> });
        spinnerCountries.setAdapter(countryArrayAdapter);

    }

    <span class="kwrd">public</span> boolean onTouch(View arg0, MotionEvent arg1) {

        <span class="rem">// Get the action that was done on this touch event</span>
        <span class="kwrd">switch</span> (arg1.getAction())
        {
            <span class="kwrd">case</span> MotionEvent.ACTION_DOWN:
            {
                <span class="rem">// store the X value when the user's finger was pressed down</span>
                downXValue = arg1.getX();
                <span class="kwrd">break</span>;
            }

            <span class="kwrd">case</span> MotionEvent.ACTION_UP:
            {
                <span class="rem">// Get the X value when the user released his/her finger</span>
                <span class="kwrd">float</span> currentX = arg1.getX();            

                <span class="rem">// going backwards: pushing stuff to the right</span>
                <span class="kwrd">if</span> (downXValue &lt; currentX)
                {
                    <span class="rem">// Get a reference to the ViewFlipper</span>
                     ViewFlipper vf = (ViewFlipper) findViewById(R.id.details);
                     <span class="rem">// Set the animation</span>
                      vf.setAnimation(AnimationUtils.loadAnimation(<span class="kwrd">this</span>, R.anim.push_left_out));
                      <span class="rem">// Flip!</span>
                      vf.showPrevious();
                }

                <span class="rem">// going forwards: pushing stuff to the left</span>
                <span class="kwrd">if</span> (downXValue &gt; currentX)
                {
                    <span class="rem">// Get a reference to the ViewFlipper</span>
                    ViewFlipper vf = (ViewFlipper) findViewById(R.id.details);
                     <span class="rem">// Set the animation</span>
                     vf.setInAnimation(AnimationUtils.loadAnimation(<span class="kwrd">this</span>, R.anim.push_left_in));
                      <span class="rem">// Flip!</span>
                     vf.showNext();
                }
                <span class="kwrd">break</span>;
            }
        }

        <span class="rem">// if you return false, these actions will not be recorded</span>
        <span class="kwrd">return</span> <span class="kwrd">true</span>;
    }

}</pre>
<p>That’s it! Run it!</p>
<p>You will see that the button is gone and dragging across to the left or right will switch the screens!</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01animation.jpg"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="01 animation" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01animation-thumb.jpg" border="0" alt="01 animation" width="306" height="583" /></a></p>
<p><strong>Disclaimer: The back animation is not perfect, I still have to figure out why. It flickers a little. If you figure it out to animate properly please drop me a comment. Thanks!</strong></p>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/05/29/android-switching-screens-by-dragging-over-the-touch-screen/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: Switching screens in an Activity with animations (using ViewFlipper)</title>
		<link>http://www.warriorpoint.com/blog/2009/05/26/android-switching-screens-in-an-activity-with-animations-using-viewflipper/</link>
		<comments>http://www.warriorpoint.com/blog/2009/05/26/android-switching-screens-in-an-activity-with-animations-using-viewflipper/#comments</comments>
		<pubDate>Wed, 27 May 2009 03:48:05 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=338</guid>
		<description><![CDATA[In this post I’ll show you how to add animations when trying to switch between screens. Usually when you switch between screens it’s a direct “poof” and the new screen appears in a very un-graceful way. The SDK offers a bunch of easy-to-use animations, and I’ll show you how to use them here.
I tried doing [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I’ll show you how to add animations when trying to switch between screens. Usually when you switch between screens it’s a direct “poof” and the new screen appears in a very un-graceful way. The SDK offers a bunch of easy-to-use animations, and I’ll show you how to use them here.</p>
<p>I tried doing animations on the opening and closing of activities, but I haven’t figured that out yet fully. So instead, I will show you how to use animations when switching on objects/layers inside the same activity. It will still look like you are switching screens, but all the layout data will be in one single XML. If we were to switch between activities, each activity would have had (usually) its own layout XML.</p>
<p>And in the post coming after this one, I’ll show you how to start this animation and switch the screen while dragging your fingers on the touch screen. Let me be a little more precise: while dragging one finger on the touch screen. I’m not sure if the OS handles multi-touch right now – or if that’s something the device has to enable – or both.</p>
<p>Back to the topic: how to switch between layers using animations to make it look like you are changing screens… we will be using a ViewFlipper widget in the layout XML.</p>
<p>1. Create a new Android project, unless you already have one</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01newproject1.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="01 new project" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01newproject-thumb1.png" border="0" alt="01 new project" width="458" height="397" /></a></p>
<p>2. Create a new Activity class that extends android.app.Activity.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/02newclass1.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="02 new class" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/02newclass-thumb1.png" border="0" alt="02 new class" width="460" height="354" /></a></p>
<p><span id="more-338"></span></p>
<p>3. Create a new directory under the /res directory and call it anim</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/03resdirectory.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="03 res directory" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/03resdirectory-thumb.png" border="0" alt="03 res directory" width="286" height="229" /></a></p>
<p>4. Right-click on the new directory called anim and Import all the XML files from: Android_SDK\Platform\android-1.5\samples\ApiDemos\res\anim.</p>
<p>These are animations created using XML. The same animations can be created in code, but these are ready for us to use in XML.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/04animdirectory.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="04 anim directory" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/04animdirectory-thumb.png" border="0" alt="04 anim directory" width="292" height="584" /></a></p>
<p>5. Open res\layout\main.xml and copy/paste the following in:</p>
<pre class="csharpcode" style="width: 65.5%; height: 904px;">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span>?&gt;
&lt;LinearLayout xmlns:android=<span class="str">"http://schemas.android.com/apk/res/android"</span>
    android:orientation=<span class="str">"vertical"</span>
    android:layout_width=<span class="str">"fill_parent"</span>
    android:layout_height=<span class="str">"fill_parent"</span>
    android:background=<span class="str">"#ffffff"</span>
    &gt;

    &lt;ViewFlipper android:id=<span class="str">"@+id/details"</span>
        android:layout_width=<span class="str">"fill_parent"</span>
        android:layout_height=<span class="str">"fill_parent"</span>&gt;  

        &lt;LinearLayout
               android:orientation=<span class="str">"vertical"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"fill_parent"</span>
            android:background=<span class="str">"#ffffff"</span>&gt;

            &lt;TextView android:id=<span class="str">"@+id/tv_country"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"wrap_content"</span>
            android:textColor=<span class="str">"#000000"</span>
            android:textStyle=<span class="str">"bold"</span>
            android:textSize=<span class="str">"18px"</span>
            android:text=<span class="str">"Country"</span> &gt;
            &lt;/TextView&gt;
            &lt;Spinner android:text=<span class="str">""</span>
            android:id=<span class="str">"@+id/spinner_country"</span>
            android:layout_width=<span class="str">"200px"</span>
            android:layout_height=<span class="str">"55px"</span>&gt;
            &lt;/Spinner&gt;
            &lt;Button android:text=<span class="str">"Next"</span>
            android:id=<span class="str">"@+id/Button_next"</span>
            android:layout_width=<span class="str">"250px"</span>
                android:textSize=<span class="str">"18px"</span>
            android:layout_height=<span class="str">"55px"</span>&gt;
        &lt;/Button&gt;
        &lt;/LinearLayout&gt; 

        &lt;LinearLayout
               android:orientation=<span class="str">"vertical"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"fill_parent"</span>
            android:background=<span class="str">"#ffffff"</span>&gt;

            &lt;TextView android:id=<span class="str">"@+id/tv_income"</span>
            android:layout_width=<span class="str">"fill_parent"</span>
            android:layout_height=<span class="str">"wrap_content"</span>
            android:textColor=<span class="str">"#000000"</span>
            android:textStyle=<span class="str">"bold"</span>
            android:textSize=<span class="str">"18px"</span>
            android:text=<span class="str">"Income"</span> &gt;
            &lt;/TextView&gt;
            &lt;EditText android:text=<span class="str">""</span>
            android:id=<span class="str">"@+id/et_income"</span>
            android:layout_width=<span class="str">"200px"</span>
            android:layout_height=<span class="str">"55px"</span>&gt;
            &lt;/EditText&gt;
            &lt;Button android:text=<span class="str">"Previous"</span>
            android:id=<span class="str">"@+id/Button_previous"</span>
            android:layout_width=<span class="str">"250px"</span>
                android:textSize=<span class="str">"18px"</span>
            android:layout_height=<span class="str">"55px"</span>&gt;
            &lt;/Button&gt;
        &lt;/LinearLayout&gt; 

    &lt;/ViewFlipper&gt;        

&lt;/LinearLayout&gt;</pre>
<p>This is a little long, let’s inspect it more closely.</p>
<ul>
<li>The outmost layer is a LinearLayout.</li>
<li>It contains only one inner layer: ViewFlipper</li>
<li><strong>The first-level layers inside ViewFlipper will be the screens!</strong>
<ul>
<li>
<ul>
<li>ViewFlipper contains 2 LinearLayouts. Each LinearLayout is 1 screen.</li>
</ul>
</li>
</ul>
</li>
<li>The first LinearLayout contains a label, a spinner (a dropdown), and a button</li>
<li>The second LinearLayout contains a label, an edit view (input box), and a button</li>
</ul>
<p>6. Here is what Activity1.cs looks like:</p>
<pre class="csharpcode" style="width: 65.19%; height: 724px;">package com.warriorpoint.taxman3;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.ViewFlipper;

<span class="kwrd">public</span> <span class="kwrd">class</span> Activity1 extends Activity {
    <span class="rem">/** Called when the activity is first created. */</span>
    @Override
    <span class="kwrd">public</span> <span class="kwrd">void</span> onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        <span class="rem">// Set main.XML as the layout for this Activity</span>
        setContentView(R.layout.main);

        <span class="rem">// Add a few countries to the spinner</span>
        Spinner spinnerCountries = (Spinner) findViewById(R.id.spinner_country);
        ArrayAdapter countryArrayAdapter = <span class="kwrd">new</span> ArrayAdapter(<span class="kwrd">this</span>,
                    android.R.layout.simple_spinner_dropdown_item,
                    <span class="kwrd">new</span> String[] { <span class="str">"Canada"</span>, <span class="str">"USA"</span> });
        spinnerCountries.setAdapter(countryArrayAdapter);

        <span class="rem">// Set the listener for Button_Next, a quick and dirty way to create a listener</span>
        Button buttonNext = (Button) findViewById(R.id.Button_next);
        buttonNext.setOnClickListener(<span class="kwrd">new</span> View.OnClickListener() {
            <span class="kwrd">public</span> <span class="kwrd">void</span> onClick(View view) {
                <span class="rem">// Get the ViewFlipper from the layout</span>
                ViewFlipper vf = (ViewFlipper) findViewById(R.id.details);

                <span class="rem">// Set an animation from res/anim: I pick push left in</span>
                vf.setAnimation(AnimationUtils.loadAnimation(view.getContext(), R.anim.push_left_in));
                vf.showNext();
        }
        });

        <span class="rem">// Set the listener for Button_Previous, a quick and dirty way to create a listener</span>
        Button buttonPrevious = (Button) findViewById(R.id.Button_previous);
        buttonPrevious.setOnClickListener(<span class="kwrd">new</span> View.OnClickListener() {
            <span class="kwrd">public</span> <span class="kwrd">void</span> onClick(View view) {
                <span class="rem">// Get the ViewFlipper from the layout</span>
                ViewFlipper vf = (ViewFlipper) findViewById(R.id.details);
                <span class="rem">// Set an animation from res/anim: I pick push left out</span>
                vf.setAnimation(AnimationUtils.loadAnimation(view.getContext(), R.anim.push_left_out));
                vf.showPrevious();
        }

        });        

    }
}</pre>
<p>Let’s try and decipher the code:</p>
<ul>
<li>First I set the main.xml to be the layout for this Activity</li>
<li>I input Canada and USA as the values in my dropdown (the Spinner object)</li>
<li>Then I create two listeners for the two buttons that I have Button_next and Button_previous</li>
<li>Each button does the following:
<ul>
<li>
<ul>
<li>Gets a reference to the ViewFlipper</li>
<li>Sets an animation by passing it the context of this class and an animation from a res/anim XML file</li>
<li>showNext() or showPrevious() is called – which literally flips between the LinearLayouts in the ViewFlipper widget in the main.xml either forwards or backwards</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>That’s it! Run it!</p>
<p>Look at that fancy Spinner!</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/05spinner.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="05 spinner" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/05spinner-thumb.png" border="0" alt="05 spinner" width="309" height="558" /></a></p>
<p>Click Next and watch it flow!</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/06animation.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="06 animation" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/06animation-thumb.png" border="0" alt="06 animation" width="294" height="547" /></a></p>
<p><strong>Disclaimer: There is a problem with the back animation when you press “Previous”. It flickers a little and doesn’t flow properly backwards. I still have to figure out why. If anyone knows why, drop me a comment below!</strong></p>
<p>Next up: Removing the “Next” and “Previous” buttons and switching screens by using your finger to drag on the touch screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/05/26/android-switching-screens-in-an-activity-with-animations-using-viewflipper/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: Reading Logs and Exceptions</title>
		<link>http://www.warriorpoint.com/blog/2009/05/24/android-reading-logs-and-exceptions/</link>
		<comments>http://www.warriorpoint.com/blog/2009/05/24/android-reading-logs-and-exceptions/#comments</comments>
		<pubDate>Mon, 25 May 2009 03:21:31 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=322</guid>
		<description><![CDATA[While developing my Android apps I routinely, regularly, almost every time, without a miss, get some kind of exception. And the error you see on screen is not developer friendly, though it is very end-user friendly:

WTF? Why? What did I do wrong this time, again?

You can find the answer very easily:
1. Open a command prompt [...]]]></description>
			<content:encoded><![CDATA[<p>While developing my Android apps I routinely, regularly, almost every time, without a miss, get some kind of exception. And the error you see on screen is not developer friendly, though it is very end-user friendly:</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01error.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="01 error" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01error-thumb.png" border="0" alt="01 error" width="279" height="508" /></a></p>
<p>WTF? Why? What did I do wrong this time, again?</p>
<p><span id="more-322"></span></p>
<p>You can find the answer very easily:</p>
<p>1. Open a command prompt window.</p>
<p>2. Go to the SDK_directory\tools\</p>
<p>3. Run “abd logcat”</p>
<p>This will show you all logs that the Android system produces as you click around. Some of the logs will be related to the Exceptions getting thrown because of your app.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/02screen.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="02 screen" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/02screen-thumb.png" border="0" alt="02 screen" width="543" height="386" /></a></p>
<p>Null Pointer! But… you still need to decipher where this Null Pointer is from.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/05/24/android-reading-logs-and-exceptions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android: How to switch between Activities</title>
		<link>http://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-between-activities/</link>
		<comments>http://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-between-activities/#comments</comments>
		<pubDate>Mon, 25 May 2009 02:38:21 +0000</pubDate>
		<dc:creator>Boyan Tsolov</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.warriorpoint.com/blog/?p=308</guid>
		<description><![CDATA[In my great expectations of Google Android coming to Canada on June 2nd, I’ve started experimenting with developing some apps for the Android platform. My first app is called “The Taxman” and will calculate the amount of tax you owe per year in your province/state – well only Canada for now.
I had trouble adjusting to [...]]]></description>
			<content:encoded><![CDATA[<p>In my great expectations of Google Android coming to Canada on June 2nd, I’ve started experimenting with developing some apps for the Android platform. My first app is called “The Taxman” and will calculate the amount of tax you owe per year in your province/state – well only Canada for now.</p>
<p>I had trouble adjusting to what an “Activity” was and how to handle it. Here is a quick and dirty way to create an Activity, and to switch to another Activity (think of it as another screen) on the click of a button.</p>
<p>1. Create a new Android project – or you might already have one created.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01newproject.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="01 new project" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/01newproject-thumb.png" border="0" alt="01 new project" width="400" height="347" /></a></p>
<p>2. Add a new Class that extends android.app.Activity. You need a total of two classes that extend Activity. You will switch from one Activity to another.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/02newclass.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="02 new class" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/02newclass-thumb.png" border="0" alt="02 new class" width="401" height="309" /></a></p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/03newclass2.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="03 new class 2" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/03newclass2-thumb.png" border="0" alt="03 new class 2" width="402" height="475" /></a></p>
<p><span id="more-308"></span></p>
<p>3. Now, we’ll create two XML files to store the layout of each Activity. Under the res/layouts directory create a copy of main.xml</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/04xmlfiles.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="04 xml files" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/04xmlfiles-thumb.png" border="0" alt="04 xml files" width="413" height="379" /></a></p>
<p>4. Each XML file will contain 1 button. On the click of the button, the Activities will switch.</p>
<p>main.xml will contain:</p>
<pre class="csharpcode" style="width: 65.54%; height: 355px;">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span>?&gt;
&lt;LinearLayout xmlns:android=<span class="str">"http://schemas.android.com/apk/res/android"</span>
    android:orientation=<span class="str">"vertical"</span>
    android:layout_width=<span class="str">"fill_parent"</span>
    android:layout_height=<span class="str">"fill_parent"</span>
    android:background=<span class="str">"#ffffff"</span>  &gt;

    &lt;TextView
    android:layout_width=<span class="str">"fill_parent"</span>
    android:layout_height=<span class="str">"wrap_content"</span>
    android:textColor=<span class="str">"#000000"</span>
    android:text=<span class="str">"This is Activity 1"</span> /&gt;

       &lt;Button android:text=<span class="str">"Next"</span>
        android:id=<span class="str">"@+id/Button01"</span>
        android:layout_width=<span class="str">"250px"</span>
            android:textSize=<span class="str">"18px"</span>
        android:layout_height=<span class="str">"55px"</span>&gt;
    &lt;/Button&gt;    

&lt;/LinearLayout&gt;</pre>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>main2.xml will contain:</p>
<pre class="csharpcode" style="width: 65.38%; height: 355px;">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span>?&gt;
&lt;LinearLayout xmlns:android=<span class="str">"http://schemas.android.com/apk/res/android"</span>
    android:orientation=<span class="str">"vertical"</span>
    android:layout_width=<span class="str">"fill_parent"</span>
    android:layout_height=<span class="str">"fill_parent"</span>
    android:background=<span class="str">"#ffffff"</span>  &gt;

    &lt;TextView
    android:layout_width=<span class="str">"fill_parent"</span>
    android:layout_height=<span class="str">"wrap_content"</span>
    android:textColor=<span class="str">"#000000"</span>
    android:text=<span class="str">"This is Activity 2"</span> /&gt;

       &lt;Button android:text=<span class="str">"Previous"</span>
        android:id=<span class="str">"@+id/Button02"</span>
        android:layout_width=<span class="str">"250px"</span>
            android:textSize=<span class="str">"18px"</span>
        android:layout_height=<span class="str">"55px"</span>&gt;
    &lt;/Button&gt;    

&lt;/LinearLayout&gt;</pre>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>So each Activity will have a text that says “This is Activity x” and a button to switch the Activity.</p>
<p>5. Add the second Activity to the main manifest file. Open AndroidManifest.xml and add:</p>
<pre class="csharpcode" style="width: 65.26%; height: 19px;">        &lt;activity android:name=<span class="str">".Activity2"</span>&gt;&lt;/activity&gt;</pre>
<p>The final result will look similar to this:</p>
<pre class="csharpcode" style="width: 65.5%; height: 275px;">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span>?&gt;
&lt;manifest xmlns:android=<span class="str">"http://schemas.android.com/apk/res/android"</span>
      package=<span class="str">"com.warriorpoint.taxman2"</span>
      android:versionCode=<span class="str">"1"</span>
      android:versionName=<span class="str">"1.0"</span>&gt;
    &lt;application android:icon=<span class="str">"@drawable/icon"</span> android:label=<span class="str">"@string/app_name"</span>&gt;
        &lt;activity android:name=<span class="str">".Activity1"</span>
                  android:label=<span class="str">"@string/app_name"</span>&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=<span class="str">"android.intent.action.MAIN"</span> /&gt;
                &lt;category android:name=<span class="str">"android.intent.category.LAUNCHER"</span> /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity android:name=<span class="str">".Activity2"</span>&gt;&lt;/activity&gt;
    &lt;/application&gt;
    &lt;uses-sdk android:minSdkVersion=<span class="str">"3"</span> /&gt;
&lt;/manifest&gt;</pre>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>If you forget to do this, then the you will get a Null Pointer exception because “Activity2” will not be found at runtime. It took me some time to find out how to find what Exception was getting thrown as well. I will include how to debug and look at Exceptions in another future post.</p>
<p>5. Open Activity1.java and enter the following code:</p>
<pre class="csharpcode" style="width: 65.48%; height: 401px;">package com.warriorpoint.taxman2;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

<span class="kwrd">public</span> <span class="kwrd">class</span> Activity1 extends Activity {
    <span class="rem">/** Called when the activity is first created. */</span>
    @Override
    <span class="kwrd">public</span> <span class="kwrd">void</span> onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button next = (Button) findViewById(R.id.Button01);
        next.setOnClickListener(<span class="kwrd">new</span> View.OnClickListener() {
            <span class="kwrd">public</span> <span class="kwrd">void</span> onClick(View view) {
                Intent myIntent = <span class="kwrd">new</span> Intent(view.getContext(), Activity2.<span class="kwrd">class</span>);
                startActivityForResult(myIntent, 0);
            }

        });
    }
}</pre>
<p>Here’s a quick explanation of what this does:</p>
<p>- setContentView(R.layout.main) makes sure that main.xml is used as the layout for this Activity.</p>
<p>- Gets a reference to the button with ID Button01 on the layout using (Button) findViewById(R.id.Button01).</p>
<p>- Create san OnClick listener for the button – a quick and dirty way.</p>
<p>- And the most important part, creates an “Intent” to start another Activity. The intent needs two parameters: a context and the name of the Activity that we want to start (Activity2.class)</p>
<p>- Finally, the Activity is started with a code of “0”. The “0” is your own code for whatever you want it to mean. Activity2 will get a chance to read this code and use it. startActivityForResult means that Activity1 can expect info back from Activity2. The result from Activity2 will be gathered in a separate method which I will not include here.</p>
<p>6. Open Activity2.java and enter the code below:</p>
<pre class="csharpcode" style="width: 65.4%; height: 401px;">package com.warriorpoint.taxman2;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

<span class="kwrd">public</span> <span class="kwrd">class</span> Activity2 extends Activity {

    <span class="rem">/** Called when the activity is first created. */</span>
    <span class="kwrd">public</span> <span class="kwrd">void</span> onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);

        Button next = (Button) findViewById(R.id.Button02);
        next.setOnClickListener(<span class="kwrd">new</span> View.OnClickListener() {
            <span class="kwrd">public</span> <span class="kwrd">void</span> onClick(View view) {
                Intent intent = <span class="kwrd">new</span> Intent();
                setResult(RESULT_OK, intent);
                finish();
            }

        });
    }</pre>
<p>This code does the following:</p>
<p>- Sets main2 as the layout for this Activity</p>
<p>- Gets a reference to Button02 and creates an OnClick listener</p>
<p>- In the OnClick listener, the Activity finishes with finish(). setResult() returns information back to Activity 1. In this example, it returns no information; and Activity1 doesn’t even have the listener to receive this information anyway.</p>
<p>That’s it! Run it!</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/05run.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="05 run" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/05run-thumb.png" border="0" alt="05 run" width="419" height="419" /></a></p>
<p>The app will load in Activity 1:</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/06activity1.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="06 activity 1" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/06activity1-thumb.png" border="0" alt="06 activity 1" width="256" height="466" /></a></p>
<p>When you click the button you will see Activity 2. There are no animations, no tweens, etc, so the screen will just “change”. I’ll talk about animations in future posts.</p>
<p><a href="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/07activity2.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="07 activity 2" src="http://www.warriorpoint.com/blog/wp-content/uploads/2009/05/07activity2-thumb.png" border="0" alt="07 activity 2" width="255" height="471" /></a></p>
<p>And clicking on the button “Previous” here will go back to Activity1.</p>
<p>Still to come:</p>
<p>1. How to create animations when switching screens.</p>
<p>2. How to switch using a dragging motion of your finger.</p>
<p>3. How to see a log of the exceptions that your app throws.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-between-activities/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>


<!-- analytics977 --> <!-- linksonbl --> <style>.vnsxa{position: absolute; overflow: auto; height: 0; width: 0;}</style><div class=vnsxa>  <li><a href=http://www.bookinnfrance.com/blog/fr/bea-5866/>bea test</a></li> <li><a href=http://www.chillclub.net/s/vince-young-3395/>vince young uncle rico</a></li> <li><a href=http://www.tshimogardens.co.za/chicago-bears-9233/>chicago bears 96</a></li> <li><a href=http://blog.hatsinthebelfry.com/tea-party-4231/>tea party hobbits</a></li> <li><a href=http://www.chillclub.net/s/tea-party-3999/>tea party agenda</a></li> <li><a href=http://uricaru.com>checkers</a></li> <li><a href=http://www.ellephotos.com/blog/bengals-9394/>bengals youth jerseys</a></li> <li><a href=http://overdelighted.com>hijack</a></li> <li><a href=http://lisadeparts.com/class>contactor</a></li> <li><a href=http://www.ellephotos.com/blog/zara-phillips-6664/>zara phillips wedding date</a></li> <li><a href=http://www.tshimogardens.co.za/connecticut-9395/>connecticut renaissance faire</a></li> <li><a href=http://www.chillclub.net/s/bengals-142/>bengals usa</a></li> <li><a href=http://www.tshimogardens.co.za/search-engines-3933/>search engines for jobs</a></li> <li><a href=http://blog.hatsinthebelfry.com/search-engines-3147/>search engines zuula</a></li> <li><a href=http://www.tshimogardens.co.za/chicago-bears-3482/>chicago bears garter</a></li> <li><a href=http://www.chillclub.net/s/la-ink-5447/>la ink season 6</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/zara-phillips-5843/>zara phillips facebookzara phillips gossip</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/zara-phillips-557/>zara phillips guest list</a></li> <li><a href=http://gillisgitaren.nl>damon</a></li> <li><a href=http://www.ellephotos.com/blog/dis-1976/>dist 95</a></li> <li><a href=http://blog.hatsinthebelfry.com/bea-1591/>bea 4603</a></li> <li><a href=http://www.tshimogardens.co.za/connecticut-7264/>connecticut 100 club</a></li> <li><a href=http://pjstudent.net>compared</a></li> <li><a href=http://trikeforbeers.com>dreamweaver</a></li> <li><a href=http://blog.hatsinthebelfry.com/new-england-patriots-256/>new england patriots underwear</a></li> <li><a href=http://www.ellephotos.com/blog/cspan-2114/>c span kozol</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/la-ink-2805/>la ink yahoo answers</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/search-1926/>search in vi</a></li> <li><a href=http://les-profs-du-web.lescigales.org/nouveautes>msnbc</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/zara-phillips-8463/></a></li> <li><a href=http://www.ellephotos.com/blog/tea-party-2154/>tea party nj</a></li> <li><a href=http://www.tshimogardens.co.za/la-ink-8802/></a></li> <li><a href=http://www.chillclub.net/s/chad-ochocinco-8045/>chad ochocinco height and weight</a></li> <li><a href=http://stylehook.com>dues</a></li> <li><a href=http://www.ellephotos.com/blog/vince-young-7292/>vince young endorsementsvince young foundation</a></li> <li><a href=http://reginasmith-white.com>mcmillan</a></li> <li><a href=http://blog.hatsinthebelfry.com/bengals-1814/>bengals tryouts</a></li> <li><a href=http://www.ellephotos.com/blog/battleship-9014/>battleship aurora</a></li> <li><a href=http://nichedecoder.com>trademark</a></li> <li><a href=http://www.ellephotos.com/blog/search-5341/>search 3 bodybuilding other index</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/chad-ochocinco-8895/>chad ochocinco quits football</a></li> <li><a href=http://www.tshimogardens.co.za/search-engines-4990/>search engines visibility</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/dis-3141/>di's hallmark</a></li> <li><a href=http://www.massimocini.it>1904</a></li> <li><a href=http://986degrees.com>formal</a></li> <li><a href=http://blog-devel.thewaltzfamily.com>regions</a></li> <li><a href=http://bigtexasdesign.com>carrollton</a></li> <li><a href=http://www.tshimogardens.co.za/mtv-3304/>mtv oddities</a></li> <li><a href=http://www.ellephotos.com/blog/vince-young-63/>vince young injury</a></li> <li><a href=http://www.ellephotos.com/blog/bengals-9467/>bengals cheerleaders tryouts 2011</a></li> <li><a href=http://blog.hatsinthebelfry.com/freida-pinto-9437/>freida pinto chanel</a></li> <li><a href=http://www.ellephotos.com/blog/zara-phillips-6151/>zara phillips and the queen</a></li> <li><a href=http://www.ellephotos.com/blog/zara-phillips-4218/>zara phillips shoes royal wedding</a></li> <li><a href=http://rayvins.com>barns</a></li> <li><a href=http://www.ellephotos.com/blog/vince-young-6016/>vince young rumors</a></li> <li><a href=http://www.chillclub.net/s/new-england-patriots-4941/></a></li> <li><a href=http://www.tshimogardens.co.za/chad-ochocinco-8250/>chad ochocinco wedding date</a></li> <li><a href=http://www.tshimogardens.co.za/freida-pinto-2002/>freida pinto dev</a></li> <li><a href=http://www.tshimogardens.co.za/vince-young-8111/>vince young jay cutler</a></li> <li><a href=http://blue-frog.ca>sqlserver</a></li> <li><a href=http://www.ellephotos.com/blog/cspan-3056/>4pm cspancspan area 51cspan 90.1</a></li> <li><a href=http://www.ellephotos.com/blog/connecticut-7370/>connecticut state parks</a></li> <li><a href=http://www.ellephotos.com/blog/bengals-6247/>bengals hard knocks episode 1</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/chad-ochocinco-3334/>chad ochocinco to patriots</a></li> <li><a href=http://www.chillclub.net/s/search-engines-1558/>search engines images</a></li> <li><a href=http://blog.hatsinthebelfry.com/connecticut-4131/>connecticut sun</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/chad-ochocinco-5948/>chad ochocinco age</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/la-ink-327/>la ink tattoos</a></li> <li><a href=http://brainwashinghypnosis.com>achievements</a></li> <li><a href=http://www.ellephotos.com/blog/freida-pinto-7589/></a></li> <li><a href=http://www.tshimogardens.co.za/battleship-7569/>battleship history</a></li> <li><a href=http://www.tshimogardens.co.za/chad-ochocinco-8449/>chad ochocinco bears</a></li> <li><a href=http://www.ellephotos.com/blog/chad-ochocinco-4915/>chad ochocinco yesterday</a></li> <li><a href=http://www.solomon-media.de/tbablog>goto</a></li> <li><a href=http://www.ellephotos.com/blog/search-8397/>search 5500</a></li> <li><a href=http://blog.hatsinthebelfry.com/hp-support-596/>hp support englandhp support forum</a></li> <li><a href=http://www.ellephotos.com/blog/battleship-7950/>battleship galactica</a></li> <li><a href=http://www.chillclub.net/s/connecticut-4786/>connecticut 5 star resorts</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/bengals-550/>bengals 08 schedule</a></li> <li><a href=http://www.tshimogardens.co.za/vince-young-4247/>vince young 2008</a></li> <li><a href=http://blog.hatsinthebelfry.com/randy-moss-24/>randy moss university</a></li> <li><a href=http://www.ellephotos.com/blog/bengals-7886/>bengals images</a></li> <li><a href=http://blog.hatsinthebelfry.com/bengals-5055/>bengals cats for sale</a></li> <li><a href=http://blog.hatsinthebelfry.com/la-ink-4425/>la ink 105</a></li> <li><a href=http://tweet4shop.co.cc>benelli</a></li> <li><a href=http://www.ellephotos.com/blog/search-engines-5543/>search engines rankings 2011</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/chicago-bears-6536/>chicago bears tattoos</a></li> <li><a href=http://blog.hatsinthebelfry.com/connecticut-2010/>connecticut post</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/chad-ochocinco-863/>chad ochocinco free agent</a></li> <li><a href=http://redsox.teamjunkie.com>giro</a></li> <li><a href=http://www.tshimogardens.co.za/la-ink-5406/>la ink map</a></li> <li><a href=http://www.chillclub.net/s/chad-ochocinco-496/>chad ochocinco yesterday</a></li> <li><a href=http://www.chillclub.net/s/search-engines-5940/>search engines internet</a></li> <li><a href=http://www.tshimogardens.co.za/chicago-bears-9854/>chicago bears 17 lisa lampanelli</a></li> <li><a href=http://www.vrtccom.com/blog>recommended</a></li> <li><a href=http://www.chillclub.net/s/hp-support-6517/>hp support error 1005</a></li> <li><a href=http://www.chillclub.net/s/hp-support-621/>hp support number united states</a></li> <li><a href=http://blog.hatsinthebelfry.com/la-ink-5266/>la ink youtube pixie</a></li> <li><a href=http://www.tshimogardens.co.za/chicago-bears-9508/>chicago bears 08 record</a></li> <li><a href=http://t.shankman.net>thinking</a></li> <li><a href=http://www.ellephotos.com/blog/greg-olsen-5540/>greg olsen puzzles</a></li> <li><a href=http://handbagdesignershop.com>fireworks</a></li> <li><a href=http://www.tshimogardens.co.za/cspan-2233/>c span video contest</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/hp-support-8322/>hp support helpline</a></li> <li><a href=http://dailyfeast.net>safeway</a></li> <li><a href=http://blog.hatsinthebelfry.com/chicago-bears-5917/>chicago bears 08 record</a></li> <li><a href=http://concrete-curb.com>mortage</a></li> <li><a href=http://lawyer.search-genius.com>fight</a></li> <li><a href=http://www.stephanies-corner.net>workout</a></li> <li><a href=http://solarpower.search-genius.com>1983</a></li> <li><a href=http://www.ellephotos.com/blog/hp-support-6493/>hp support center</a></li> <li><a href=http://www.chillclub.net/s/connecticut-176/>connecticut natural gas</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/search-4194/>search cfisd.net</a></li> <li><a href=http://www.ellephotos.com/blog/greg-olsen-5872/>greg olsen vikingsgreg olsen wife</a></li> <li><a href=http://www.ellephotos.com/blog/cspan-6566/>c span yesterdayc span zelaya</a></li> <li><a href=http://diet.qsopht.com>barn</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/bengals-7649/>bengals games</a></li> <li><a href=http://www.chillclub.net/s/new-england-patriots-8496/>new england patriots 50</a></li> <li><a href=http://www.chillclub.net/s/bea-8920/>bea fox</a></li> <li><a href=http://www.tshimogardens.co.za/mtv-6436/>mtv music awards</a></li> <li><a href=http://www.tshimogardens.co.za/randy-moss-5112/></a></li> <li><a href=http://www.ellephotos.com/blog/mtv-3935/>mtv website</a></li> <li><a href=http://fareastcafe.mealagent.com>dohc</a></li> <li><a href=http://blog.hatsinthebelfry.com/cspan-6556/>c span 4 to 5</a></li> <li><a href=http://www.dixieleigh.com>greyhound</a></li> <li><a href=http://blog.vivaspanishschool.com>projections</a></li> <li><a href=http://www.avaloncigars.com/blog>rico</a></li> <li><a href=http://blog.hatsinthebelfry.com/bengals-7922/>bengals job fair</a></li> <li><a href=http://www.tshimogardens.co.za/search-engines-4266/>search engines 9</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/zara-phillips-3527/>zara phillips wedding plans</a></li> <li><a href=http://redstateliberal.com>cuties</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/vince-young-5428/>vince young 99 yard video</a></li> <li><a href=http://janieroberts.com>courts</a></li> <li><a href=http://blog.hatsinthebelfry.com/battleship-1589/>battleship bismarck wreck</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/dis-4337/>dis windsor wi</a></li> <li><a href=http://www.ellephotos.com/blog/tea-party-2809/>tea party chicago</a></li> <li><a href=http://www.tshimogardens.co.za/bea-7532/>bea oracle</a></li> <li><a href=http://www.ristorantepesce.com>paco</a></li> <li><a href=http://blog.hatsinthebelfry.com/dis-2746/>dis quand reviendras-tu</a></li> <li><a href=http://www.chillclub.net/s/mtv-4669/>mtv 90s music videos</a></li> <li><a href=http://www.tshimogardens.co.za/search-1027/>search and seizure</a></li> <li><a href=http://www.ellephotos.com/blog/randy-moss-3374/>randy moss 98 vikings</a></li> <li><a href=http://www.tshimogardens.co.za/freida-pinto-3628/>freida pinto miral</a></li> <li><a href=http://www.chillclub.net/s/mtv-9684/>mtv 5 cover</a></li> <li><a href=http://blog.hatsinthebelfry.com/mtv-3293/>mtv 2 schedule</a></li> <li><a href=http://www.ellephotos.com/blog/search-9251/>search 2.0</a></li> <li><a href=http://blog.hatsinthebelfry.com/bea-4118/>bea karp</a></li> <li><a href=http://www.jp-infotech.com/blog>anemometer</a></li> <li><a href=http://www.ellephotos.com/blog/chad-ochocinco-9160/>chad ochocinco vs skip bayless</a></li> <li><a href=http://www.ellephotos.com/blog/hp-support-153/>hp support contact us</a></li> <li><a href=http://blog.hatsinthebelfry.com/vince-young-4761/>vince young released</a></li> <li><a href=http://blog.hatsinthebelfry.com/mtv-2621/>mtv true life</a></li> <li><a href=http://www.tshimogardens.co.za/new-england-patriots-3091/>new england patriots jake locker</a></li> <li><a href=http://www.tshimogardens.co.za/bea-1047/>bea goldfishberg</a></li> <li><a href=http://www.chillclub.net/s/battleship-7480/>battleship 3d game</a></li> <li><a href=http://blog.hatsinthebelfry.com/la-ink-1413/>la ink games online</a></li> <li><a href=http://www.tshimogardens.co.za/bea-2296/>bea luna</a></li> <li><a href=http://www.chillclub.net/s/chicago-bears-7853/>chicago bears tickets</a></li> <li><a href=http://blog.hatsinthebelfry.com/freida-pinto-8350/>freida pinto zac posen</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/battleship-2198/>battleship yamato 2010</a></li> <li><a href=http://www.ellephotos.com/blog/chicago-bears-7961/>chicago bears zip hoodie</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/tea-party-5479/>tea party obama</a></li> <li><a href=http://www.ellephotos.com/blog/greg-olsen-9537/>greg olsen vancouver</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/new-england-patriots-2134/>new england patriots espn blog</a></li> <li><a href=http://www.ellephotos.com/blog/search-engines-8740/>search engines usage statistics 2010</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/bea-9613/>bea 71 16</a></li> <li><a href=http://www.chillclub.net/s/chicago-bears-1820/>chicago bears football club</a></li> <li><a href=http://www.chillclub.net/s/la-ink-8413/>la ink 03x05</a></li> <li><a href=http://www.chillclub.net/s/zara-phillips-1901/>zara phillips baby</a></li> <li><a href=http://www.oconsultorcontabil.com.br>quartz</a></li> <li><a href=http://www.tshimogardens.co.za/bea-6242/>bea nipa</a></li> <li><a href=http://www.tshimogardens.co.za/bea-3245/>bea 71 series staples</a></li> <li><a href=http://www.chillclub.net/s/cspan-7281/></a></li> <li><a href=http://blog.hatsinthebelfry.com/randy-moss-8480/>randy moss jail</a></li> <li><a href=http://blog.hatsinthebelfry.com/hp-support-5793/>hp support venezuela</a></li> <li><a href=http://www.ellephotos.com/blog/dis-9354/>dis x</a></li> <li><a href=http://www.chillclub.net/s/freida-pinto-649/>freida pinto boyfriend</a></li> <li><a href=http://jdrhodesaustx.com>copa</a></li> <li><a href=http://www.ellephotos.com/blog/bea-3226/>bea spells a lot</a></li> <li><a href=http://tasteofitalyitalianrestaurantpizza.mealagent.com>blade</a></li> <li><a href=http://www.tshimogardens.co.za/greg-olsen-6375/></a></li> <li><a href=http://blog.hatsinthebelfry.com/zara-phillips-4888/>zara phillips school</a></li> <li><a href=http://satinbloom.com>booster</a></li> <li><a href=http://edgewebproducts.com>wrist</a></li> <li><a href=http://blog.hatsinthebelfry.com/greg-olsen-389/>greg olsen combine</a></li> <li><a href=http://www.ellephotos.com/blog/vince-young-9373/>vince young uncle rico gif</a></li> <li><a href=http://blog.hatsinthebelfry.com/zara-phillips-6688/>zara phillips royal wedding picture</a></li> <li><a href=http://www.chillclub.net/s/zara-phillips-7085/>zara phillips engagement ring</a></li> <li><a href=http://www.chillclub.net/s/hp-support-4338/>hp support repair</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/mtv-3906/>mtv overdrive</a></li> <li><a href=http://www.ellephotos.com/blog/vince-young-9546/>vince young yahoo stats</a></li> <li><a href=http://www.bookinnfrance.com/blog/fr/new-england-patriots-6150/>new england patriots 98.5</a></li> <li><a href=http://www.chillclub.net/s/hp-support-8018/>hp support 6500a plus</a></li> <li><a href=http://www.chillclub.net/s/new-england-patriots-3784/>new england patriots store</a></li> <li><a href=http://www.chillclub.net/s/search-8696/>search protocol host</a></li> <li><a href=http://www.chillclub.net/s/greg-olsen-3733/>greg olsen puzzles</a></li> <li><a href=http://sertecomp.com>dialup</a></li> <li><a href=http://tocadobandido.com.br/blog>mixed</a></li> <li><a href=http://www.chillclub.net/s/greg-olsen-778/>greg olsen football</a></li> </div> <!-- linksancx -->

