<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>AgileMedicine</title>
	
	<link>http://www.agilemedicine.com/medBlog</link>
	<description>Combining medicine and technology</description>
	<pubDate>Wed, 23 Sep 2009 19:07:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/agilemedicine" /><feedburner:info uri="agilemedicine" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>AgileDiabetes – Diabetic Tracking for Android</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/83Z1QK5ZuyA/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=52#comments</comments>
		<pubDate>Wed, 23 Sep 2009 19:07:45 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemedicine.com/medBlog/?p=52</guid>
		<description><![CDATA[We have just released a new Android application for individuals with diabetes that allows tracking of blood glucose values. The new application, AgileDiabetes, allows for the easy entry of glucose values using either the touch display or keyboard. The application quickly logs and graphs the information for quick analysis. In addition, the software allows you [...]]]></description>
			<content:encoded><![CDATA[<p>We have just released a new Android application for individuals with diabetes that allows tracking of blood glucose values. The new application, <a href="www.agilemedicine.com/mainsite/agilediabetes" target="_blank">AgileDiabetes</a>, allows for the easy entry of glucose values using either the touch display or keyboard. The application quickly logs and graphs the information for quick analysis. In addition, the software allows you to easily e-mail the glucose values from a selected date range to yourself or your physician.</p>
<p>Future updates will also include the option to integrate with GoogleHealth. Please feel free to leave comments or e-mail us at <a href="mailto:info@agilemedicine.com">info@agilemedicine.com</a> for feature requests, bug reports, or comments!</p>
<p><a href="http://www.agilemedicine.com/medBlog/wp-content/uploads/2009/09/agilediabetes1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="AgileDiabetes1" border="0" alt="AgileDiabetes1" src="http://www.agilemedicine.com/medBlog/wp-content/uploads/2009/09/agilediabetes1-thumb.png" width="164" height="244" /></a> <a href="http://www.agilemedicine.com/medBlog/wp-content/uploads/2009/09/agilediabetes2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="AgileDiabetes2" border="0" alt="AgileDiabetes2" src="http://www.agilemedicine.com/medBlog/wp-content/uploads/2009/09/agilediabetes2-thumb.png" width="164" height="244" /></a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/bnwOgMlQPE7XShJv0YFrDgM0EdQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/bnwOgMlQPE7XShJv0YFrDgM0EdQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/bnwOgMlQPE7XShJv0YFrDgM0EdQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/bnwOgMlQPE7XShJv0YFrDgM0EdQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=83Z1QK5ZuyA:4QY2quKGyrg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=83Z1QK5ZuyA:4QY2quKGyrg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=83Z1QK5ZuyA:4QY2quKGyrg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=83Z1QK5ZuyA:4QY2quKGyrg:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/83Z1QK5ZuyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=52</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=52</feedburner:origLink></item>
		<item>
		<title>Silverlight 3 and DeepZoom</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/6jG6J3wGEW4/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=45#comments</comments>
		<pubDate>Thu, 27 Aug 2009 06:35:03 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Code snippets]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[deepzoom]]></category>

		<category><![CDATA[multiscaleimage]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.agilemedicine.com/medBlog/?p=45</guid>
		<description><![CDATA[Microsoft’s Silverlight 3 and the DeepZoom composer allow users to display high-resolution images interactively. This provides several benefits for either sets of images in a gallery or for smoothly viewing very large image files.
This brief tutorial will demonstrate how to set up a Silverlight 3 project with interactive zoom and panning/scrolling with a DeepZoom image.
The [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft’s Silverlight 3 and the DeepZoom composer allow users to display high-resolution images interactively. This provides several benefits for either sets of images in a gallery or for smoothly viewing very large image files.</p>
<p>This brief tutorial will demonstrate how to set up a Silverlight 3 project with interactive zoom and panning/scrolling with a DeepZoom image.</p>
<p>The first thing we will do is add the MultiScaleImage control to our automatically generated UserControl. This control contains the event handlers that we will need to interact with the deep zoom image.</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> &lt;MultiScaleImage x:Name=<span style="color: #006080">"_deepZoomImage"</span> Margin=<span style="color: #006080">"7"</span> MouseWheel=<span style="color: #006080">"_deepZoomImage_MouseWheel"</span> MouseLeftButtonDown=<span style="color: #006080">"_deepZoomImage_MouseLeftButtonDown"</span> MouseLeftButtonUp=<span style="color: #006080">"_deepZoomImage_MouseLeftButtonUp"</span> MouseMove=<span style="color: #006080">"_deepZoomImage_MouseMove"</span> MouseLeave=<span style="color: #006080">"_deepZoomImage_MouseLeave"</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span>     &lt;MultiScaleImage.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span>         &lt;DropShadowEffect ShadowDepth=<span style="color: #006080">"8"</span> BlurRadius=<span style="color: #006080">"10"</span> Color=<span style="color: #006080">"#FF605D5D"</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     &lt;/MultiScaleImage.Effect&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span> &lt;/MultiScaleImage&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>We’ve already added several event handlers to the control:</p>
<p>- MouseWheel: Event fires when the scroll wheel moves forward/backward on the mouse.</p>
<p>- MouseLeftButtonDown/Up: These events fire when the user clicks. Both will be necessary to determine if the user is clicking or dragging the image.</p>
<p>- MouseMove: Will also be used for dragging/panning the image within the control.</p>
<p>- MouseLeave: Indicates when the mouse cursor leaves the control area. Needed in case the user passes the edge of the control when panning.</p>
<p>Now that we have our control created within our XAML file, we can begin loading our images and adding the code to interact with the control. First, we need to prepare a DeepZoom image using the DeepZoom composer. There is a <a title="DeepZoom Composer Example" href="http://www.youtube.com/watch?v=lhKylKB1gc0" target="_blank">short video</a> to learn how to import images and create a Silverlight DeepZoom collection. Once created, the “GeneratedImages” folder can be uploaded to a webserver of your choice, or used locally depending on the setup of your Silverlight project (be careful for cross-zone policy issues if debugging Silverlight from the ASP webserver and using local image files).</p>
<p>We will need three global variables to keep the status of our mouse:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">bool</span> _dragging = <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> Point lastMousePosition;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span> Point lastMouseViewport;</pre>
<p><!--CRLF--></div>
</div>
<p>We can then add in our basic information into the main constructor:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> MainPage()</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span>     InitializeComponent();</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #0000ff">string</span> baseUrl = <span style="color: #006080">"http://pathToImages/"</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span>     _deepZoomImage.Source = <span style="color: #0000ff">new</span> DeepZoomImageTileSource(<span style="color: #0000ff">new</span> Uri(baseUrl + <span style="color: #006080">"/dzc_output.xml"</span>));</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum6" style="color: #606060">   6:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>The above URL can point either to the collage “dzc_output.xml” file, or to an individual deep zoom image XML file (found in the “dzc_output_images” folder). This set of code will load the image into our control as soon as the form loads. Depending on how your application functions, this can be done at any point or bound to other controls (buttons, list of albums, etc).</p>
<p>The application should compile at this point and be able to display the images. Now we can start to add some interactivity to the images.</p>
<p>First, we will add the code to tell our control when the user is dragging the image:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #008000">// Set dragging to true when user clicks their mouse within the control</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> _deepZoomImage_MouseLeftButtonDown(<span style="color: #0000ff">object</span> sender, MouseButtonEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     _dragging = <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum6" style="color: #606060">   6:</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum7" style="color: #606060">   7:</span> <span style="color: #008000">// Set dragging to false when user stops click</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum8" style="color: #606060">   8:</span> <span style="color: #008000">// If the mouse position hasn't changed, zoom in on the current location</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum9" style="color: #606060">   9:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> _deepZoomImage_MouseLeftButtonUp(<span style="color: #0000ff">object</span> sender, MouseButtonEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum10" style="color: #606060">  10:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum11" style="color: #606060">  11:</span>     _dragging = <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum12" style="color: #606060">  12:</span>     <span style="color: #0000ff">if</span> (e.GetPosition(_deepZoomImage).Equals(lastMousePosition))</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum13" style="color: #606060">  13:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum14" style="color: #606060">  14:</span>         Point mouse = e.GetPosition(_deepZoomImage);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum15" style="color: #606060">  15:</span>         _deepZoomImage.ZoomAboutLogicalPoint(1.6, (_deepZoomImage.ElementToLogicalPoint(mouse)).X, (_deepZoomImage.ElementToLogicalPoint(mouse)).Y);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum16" style="color: #606060">  16:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum17" style="color: #606060">  17:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>The first value within “ZoomAboutLogicalPoint” can be adjusted based on how far in or out you would like the image to zoom. The additional values indicate the “LogicalPoint” within the image that was clicked (a value of 0 to 1 indicating the far left/top to far right/bottom). To prevent some general bugginess within the application, we’ll also add a “stop dragging” command for when the user leaves the control:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #008000">// Set dragging to false when mouse leaves the control area</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> _deepZoomImage_MouseLeave(<span style="color: #0000ff">object</span> sender, MouseEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     _dragging = <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Now to actually handle the dragging. These statements get placed in the MouseMove event handler. If our user has clicked (_dragging == true), we can move the image. If our user hasn’t clicked, set the last position for use with dragging:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #008000">// Code to handle panning our image</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> _deepZoomImage_MouseMove(<span style="color: #0000ff">object</span> sender, MouseEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #0000ff">if</span> (_dragging)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum6" style="color: #606060">   6:</span>         Point newOrigin = <span style="color: #0000ff">new</span> Point();</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum7" style="color: #606060">   7:</span>         newOrigin = lastMouseViewport; <span style="color: #008000">// Set the last mouse position</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum8" style="color: #606060">   8:</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum9" style="color: #606060">   9:</span>         <span style="color: #008000">// Add the X and Y values of our current mouse position</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum10" style="color: #606060">  10:</span>         newOrigin.X += ((lastMousePosition.X - e.GetPosition(_deepZoomImage).X) / _deepZoomImage.ActualWidth * _deepZoomImage.ViewportWidth);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum11" style="color: #606060">  11:</span>         newOrigin.Y += ((lastMousePosition.Y - e.GetPosition(_deepZoomImage).Y) / _deepZoomImage.ActualWidth * _deepZoomImage.ViewportWidth);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum12" style="color: #606060">  12:</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum13" style="color: #606060">  13:</span>         <span style="color: #008000">// Set the Viewport origin to the new mouse location</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum14" style="color: #606060">  14:</span>         _deepZoomImage.ViewportOrigin = newOrigin;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum15" style="color: #606060">  15:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum16" style="color: #606060">  16:</span>     <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum17" style="color: #606060">  17:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum18" style="color: #606060">  18:</span>         lastMousePosition = e.GetPosition(_deepZoomImage);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum19" style="color: #606060">  19:</span>         lastMouseViewport = _deepZoomImage.ViewportOrigin;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum20" style="color: #606060">  20:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum21" style="color: #606060">  21:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>In the above code, the X and Y scroll distance is calculated by subtracting the current mouse position from the last recorded location. This value is then divided by the image’s ActualWidth and multiplied by the ViewportWidth to compensate for any zooming within the image (otherwise the image will scroll very fast or very slow if the user has zoomed in or out).</p>
<p>Almost done! We’re also going to add an event so that the use can scroll in and out using their mouse wheel:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> _deepZoomImage_MouseWheel(<span style="color: #0000ff">object</span> sender, MouseWheelEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span>     Point mouse = e.GetPosition(_deepZoomImage);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #0000ff">if</span> (e.Delta &gt; 0) <span style="color: #008000">// If scrolling in</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum6" style="color: #606060">   6:</span>         _deepZoomImage.ZoomAboutLogicalPoint(1.2, (_deepZoomImage.ElementToLogicalPoint(mouse)).X, (_deepZoomImage.ElementToLogicalPoint(mouse)).Y);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum7" style="color: #606060">   7:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum8" style="color: #606060">   8:</span>     <span style="color: #0000ff">else</span> <span style="color: #008000">// If scrolling out</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum9" style="color: #606060">   9:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum10" style="color: #606060">  10:</span>         _deepZoomImage.ZoomAboutLogicalPoint(0.8, (_deepZoomImage.ElementToLogicalPoint(mouse)).X, (_deepZoomImage.ElementToLogicalPoint(mouse)).Y);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum11" style="color: #606060">  11:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum12" style="color: #606060">  12:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>We use our Delta value to determine if the user was scrolling in or out, and then zoom using ZoomAboutLogicalPoint accordingly. Again, the first value can be changed to alter the “speed” of zooming. This works great for desktop users, but adding additional functionality for people without scroll wheels (particularly laptop users) would be necessary for a full-featured application.</p>
<p>Finally, we’re going to add one piece of XAML and an event handler in case the image gets lost so that the user can reset the zoom and position of the original image:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> &lt;Button x:Name=<span style="color: #006080">"resetZoom"</span> Height=<span style="color: #006080">"27"</span> HorizontalAlignment=<span style="color: #006080">"Right"</span> Margin=<span style="color: #006080">"0,47,128,0"</span> VerticalAlignment=<span style="color: #006080">"Top"</span> Width=<span style="color: #006080">"29"</span> Content=<span style="color: #006080">"Reset&amp;#xd;&amp;#xa;Zoom"</span> Opacity=<span style="color: #006080">"0.25"</span> FontSize=<span style="color: #006080">"8"</span> Click=<span style="color: #006080">"resetZoom_Click"</span>&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span>     &lt;Button.Background&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span>         &lt;SolidColorBrush Opacity=<span style="color: #006080">"0.5"</span> Color=<span style="color: #006080">"#FF1F3B53"</span>/&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     &lt;/Button.Background&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span> &lt;/Button&gt;</pre>
<p><!--CRLF--></div>
</div>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> resetZoom_Click(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum2" style="color: #606060">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum3" style="color: #606060">   3:</span>     _deepZoomImage.ZoomAboutLogicalPoint(_deepZoomImage.ViewportWidth, 0.5, 0.5);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum4" style="color: #606060">   4:</span>     _deepZoomImage.ViewportOrigin = <span style="color: #0000ff">new</span> Point(0, 0);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"><span id="lnum5" style="color: #606060">   5:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Since the ViewportWidth indicates how far the image is zoomed, we simply tell our control to ZoomAboutLogicalPoint with ViewportWidth as the first argument. We then reset the position to the center of the image.</p>
<p>To view the final project: <a href="http://www.agilemedicine.com/resources/DeepZoomExample">http://www.agilemedicine.com/resources/DeepZoomExample</a></p>
<p>We’ll get the full source code posted soon. If you have any questions or comments, feel free to leave them below or e-mail us at <a href="mailto:info@agilemedicine.com">info@agilemedicine.com</a>.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/g1rPRHmpdTdxiMmYAQglV_oO7J8/0/da"><img src="http://feedads.g.doubleclick.net/~a/g1rPRHmpdTdxiMmYAQglV_oO7J8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/g1rPRHmpdTdxiMmYAQglV_oO7J8/1/da"><img src="http://feedads.g.doubleclick.net/~a/g1rPRHmpdTdxiMmYAQglV_oO7J8/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=6jG6J3wGEW4:uST3lLP0yT4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=6jG6J3wGEW4:uST3lLP0yT4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=6jG6J3wGEW4:uST3lLP0yT4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=6jG6J3wGEW4:uST3lLP0yT4:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/6jG6J3wGEW4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=45</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=45</feedburner:origLink></item>
		<item>
		<title>Android Medication/Drug Reference</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/yYwyyFuP46Y/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=44#comments</comments>
		<pubDate>Sun, 10 May 2009 22:15:33 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[drug reference]]></category>

		<guid isPermaLink="false">http://www.agilemedicine.com/medBlog/?p=44</guid>
		<description><![CDATA[We get several e-mails each week regarding the availability of a drug reference for the Android platform. Unfortunately, we are unaware of any that are available as standalone applications at this time. Unfortunately, we do not own the rights to any of the currently available drug databases, and therefore cannot create an Android-specific application to [...]]]></description>
			<content:encoded><![CDATA[<p>We get several e-mails each week regarding the availability of a drug reference for the Android platform. Unfortunately, we are unaware of any that are available as standalone applications at this time. Unfortunately, we do not own the rights to any of the currently available drug databases, and therefore cannot create an Android-specific application to use them. If anyone knows of an available database, please let us know (<a href="mailto:info@agilemedicine.com">info@agilemedicine.com</a>) and we would be happy to look at creating an application to use it!</p>
<p>In the meantime, as long as 3G or wireless access is available, ePocrates does offer an online version of their application: <a title="https://online.epocrates.com/home" href="https://online.epocrates.com/home">https://online.epocrates.com/home</a>.</p>
<p>Please feel free to post links to other available references or databases in the comments if you have found one that works well!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/pVYvo9BdnaQeleTCWWZ6gcUVv0Q/0/da"><img src="http://feedads.g.doubleclick.net/~a/pVYvo9BdnaQeleTCWWZ6gcUVv0Q/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/pVYvo9BdnaQeleTCWWZ6gcUVv0Q/1/da"><img src="http://feedads.g.doubleclick.net/~a/pVYvo9BdnaQeleTCWWZ6gcUVv0Q/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=yYwyyFuP46Y:ZkmlyUrR7pE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=yYwyyFuP46Y:ZkmlyUrR7pE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=yYwyyFuP46Y:ZkmlyUrR7pE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=yYwyyFuP46Y:ZkmlyUrR7pE:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/yYwyyFuP46Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=44</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=44</feedburner:origLink></item>
		<item>
		<title>Adobe Flex: WebService XML Array Binding, Value-Enabled ComboBox</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/iJx9Pkngbyw/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=34#comments</comments>
		<pubDate>Sun, 26 Apr 2009 06:26:18 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[arraycollection]]></category>

		<category><![CDATA[combobox]]></category>

		<category><![CDATA[webservice]]></category>

		<category><![CDATA[xmllistcollection]]></category>

		<guid isPermaLink="false">http://www.agilemedicine.com/medBlog/?p=34</guid>
		<description><![CDATA[While working on a new application using Adobe Flex, one shortcoming of the ComboBox was readily apparent: there is no way to store a value and display a different string like one can do with HTML:


   1: &#60;SELECT&#62;

   2:   &#60;OPTION value="123"&#62;First String&#60;/OPTION&#62;

   3:   &#60;OPTION value="124"&#62;Second [...]]]></description>
			<content:encoded><![CDATA[<p>While working on a new application using Adobe Flex, one shortcoming of the ComboBox was readily apparent: there is no way to store a value and display a different string like one can do with HTML:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">SELECT</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum2" style="color: #606060">   2:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">OPTION</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">="123"</span><span style="color: #0000ff">&gt;</span>First String<span style="color: #0000ff">&lt;/</span><span style="color: #800000">OPTION</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum3" style="color: #606060">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">OPTION</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">="124"</span><span style="color: #0000ff">&gt;</span>Second String<span style="color: #0000ff">&lt;/</span><span style="color: #800000">OPTION</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum4" style="color: #606060">   4:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">OPTION</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">="125"</span><span style="color: #0000ff">&gt;</span>Third String<span style="color: #0000ff">&lt;/</span><span style="color: #800000">OPTION</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum5" style="color: #606060">   5:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">SELECT</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>While browsing the internet, there were several pages that either made a custom ComboBox to store the data, or went through a decent amount of loops and arrays. One other task that was difficult was trying to use the HTTPService to bind XML data to an array.</p>
<h5>HTTPService to Array</h5>
<p>This solution doesn’t bind directly to an array, but uses the XMLListCollection instead, which works similar to an ArrayCollection. The HTTPService is set up like the main examples for binding to other objects:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum1" style="color: #606060">   1:</span> &lt;mx:HTTPService id="xmlList"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum2" style="color: #606060">   2:</span>     url="http:<span style="color: #008000">//www.mywebserver.com/webService.php"</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum3" style="color: #606060">   3:</span>     result="handleXml(event)"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum4" style="color: #606060">   4:</span>     fault="handleFault(event)"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum5" style="color: #606060">   5:</span>     resultFormat="e4x"&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum6" style="color: #606060">   6:</span>     &lt;mx:request&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum7" style="color: #606060">   7:</span>         &lt;type&gt;{requestedType}&lt;/type&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum8" style="color: #606060">   8:</span>         &lt;format&gt;{requestedFormat}&lt;/format&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum9" style="color: #606060">   9:</span>     &lt;/mx:request&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum10" style="color: #606060">  10:</span> &lt;/mx:HTTPService&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>To set this data to an array (or in this case an XMLListCollection):</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum1" style="color: #606060">   1:</span> private var myXmlCollection:XMLListCollection;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum2" style="color: #606060">   2:</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum3" style="color: #606060">   3:</span> <span style="color: #0000ff">public</span> function handleXml(event:ResultEvent):void{</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum4" style="color: #606060">   4:</span>     if(event.result != ""){</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum5" style="color: #606060">   5:</span>         <span style="color: #008000">// Set the data to the XMLListCollection for lookup</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum6" style="color: #606060">   6:</span>         myXmlCollection= new XMLListCollection(event.result.node);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum7" style="color: #606060">   7:</span>         <span style="color: #008000">// Bind the ListCollection to the comboBox</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum8" style="color: #606060">   8:</span>         myComboBox.dataProvider = myXmlCollection;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum9" style="color: #606060">   9:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum10" style="color: #606060">  10:</span> }</pre>
<p><!--CRLF--></div>
</div>
<h5>Use XMLListCollection for Value-Enabled ComboBox</h5>
<p>To have the ComboBox use the current ID when we change it, we then use the “change” attribute:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum1" style="color: #606060">   1:</span> &lt;mx:Label text="My List Data: "</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum2" style="color: #606060">   2:</span>        x="10" y="40"/&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum3" style="color: #606060">   3:</span> &lt;mx:ComboBox id="xmlList"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum4" style="color: #606060">   4:</span>     x="60" y="38"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum5" style="color: #606060">   5:</span>     width="250"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum6" style="color: #606060">   6:</span>     labelField="description"</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum7" style="color: #606060">   7:</span>     change="getCurrentId()" /&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>And finally, we lookup our current value/ID:</p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> function getCurrentId():void{</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum2" style="color: #606060">   2:</span>     var o:Object = myXmlCollection.getItemAt(xmlList.selectedIndex);</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum3" style="color: #606060">   3:</span>     var currentId:String = o.nodeid.toString();</pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #008000">// Do whatever we want with our selected ID</span></pre>
<p><!--CRLF--></p>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"><span id="lnum5" style="color: #606060">   5:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>This can then be used to update other combo boxes (such as displaying a list of cities once a state is selected) or any other tasks where your ID and display value may differ for UI reasons.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/ZbY4WUW-dVgxWNC4AUZ010u2wIY/0/da"><img src="http://feedads.g.doubleclick.net/~a/ZbY4WUW-dVgxWNC4AUZ010u2wIY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ZbY4WUW-dVgxWNC4AUZ010u2wIY/1/da"><img src="http://feedads.g.doubleclick.net/~a/ZbY4WUW-dVgxWNC4AUZ010u2wIY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=iJx9Pkngbyw:Kzs5oQtsMgo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=iJx9Pkngbyw:Kzs5oQtsMgo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=iJx9Pkngbyw:Kzs5oQtsMgo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=iJx9Pkngbyw:Kzs5oQtsMgo:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/iJx9Pkngbyw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=34</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=34</feedburner:origLink></item>
		<item>
		<title>Android Programming: Transferring Data Between Intents</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/aIQeJbTKPVM/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=33#comments</comments>
		<pubDate>Sun, 19 Apr 2009 00:12:05 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Android programming]]></category>

		<category><![CDATA[Code snippets]]></category>

		<category><![CDATA[intent]]></category>

		<category><![CDATA[putextra]]></category>

		<guid isPermaLink="false">http://agilemedicine.com/medBlog/?p=33</guid>
		<description><![CDATA[While working on the development of some new applications, I have tried transferring complex variables to new intents. For example:
Transferring a single variable, or set of single variable is easily accomplished by adding them to the intent.


   1: Intent i = new Intent();

   2: i.setClassName(&#34;packageName&#34;, &#34;packageName.IntentClass&#34;);

   3: String term [...]]]></description>
			<content:encoded><![CDATA[<p>While working on the development of some new applications, I have tried transferring complex variables to new intents. For example:</p>
<p>Transferring a single variable, or set of single variable is easily accomplished by adding them to the intent.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> Intent i = <span style="color: #0000ff">new</span> Intent();</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span> i.setClassName(<span style="color: #006080">&quot;packageName&quot;</span>, <span style="color: #006080">&quot;packageName.IntentClass&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span> String term = <span style="color: #006080">&quot;data to pass&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span> i.putExtra(<span style="color: #006080">&quot;packageName.term&quot;</span>, term);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span> startActivity(i);</pre>
<p><!--CRLF--></div>
</div>
<p>In the called intent, we then get this data by calling getExtras():</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> Bundle extras = getIntent().getExtras();</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span> String term = extras.getString(<span style="color: #006080">&quot;packageName.term&quot;</span>);</pre>
<p><!--CRLF--></div>
</div>
<p>However, what if we want to pass more complex data? As you can see above, the data types that can be added as extras are somewhat limited. In order to pass an object, it must first implement either the Parcelable or Serializable class. Our next post will be on how to implement the Parcelable class, followed by a post on how to integrate a data service.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/aJSIOkX_OH1O5sY-_juefSSco0c/0/da"><img src="http://feedads.g.doubleclick.net/~a/aJSIOkX_OH1O5sY-_juefSSco0c/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/aJSIOkX_OH1O5sY-_juefSSco0c/1/da"><img src="http://feedads.g.doubleclick.net/~a/aJSIOkX_OH1O5sY-_juefSSco0c/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=aIQeJbTKPVM:nlLovAIUSF8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=aIQeJbTKPVM:nlLovAIUSF8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=aIQeJbTKPVM:nlLovAIUSF8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=aIQeJbTKPVM:nlLovAIUSF8:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/aIQeJbTKPVM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=33</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=33</feedburner:origLink></item>
		<item>
		<title>Android Programming: Basic Animation</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/40mXTfJzQSE/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=32#comments</comments>
		<pubDate>Wed, 31 Dec 2008 05:42:34 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android programming]]></category>

		<category><![CDATA[Android]]></category>

		<category><![CDATA[animation]]></category>

		<category><![CDATA[shownext]]></category>

		<category><![CDATA[viewflipper]]></category>

		<guid isPermaLink="false">http://agilemedicine.com/medBlog/?p=32</guid>
		<description><![CDATA[Saving space is a constant necessity of programming on mobile platforms. While mobile devices are extremely convenient, providing a large amount of computing power in an easy-to-carry size, the screen size can make it difficult to use complex applications. One benefit of both the iPhone/iPod and the Android platforms is the ability to use animations [...]]]></description>
			<content:encoded><![CDATA[<p>Saving space is a constant necessity of programming on mobile platforms. While mobile devices are extremely convenient, providing a large amount of computing power in an easy-to-carry size, the screen size can make it difficult to use complex applications. One benefit of both the iPhone/iPod and the Android platforms is the ability to use animations and views to provide additional screen real estate. On the Android platform, the easiest way to do this is by using the <a href="http://code.google.com/android/reference/android/widget/ViewFlipper.html" target="_blank">ViewFlipper</a> widget. This is the method we use in our <a href="http://agilemedicine.com/medBlog/?p=24" target="_blank">AgileMedCalc</a> application to provide equation information along with the calculators.</p>
<p>To use this approach, the ViewFlipper widget is added similar to a layout in the application’s XML view. Each widget or layout within the ViewFlipper will be rotated through when the showNext() property is called by the application. Because of this, if you want to have more than one widget within a single view, you will need to have additional layouts added:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> &lt;?xml version=<span style="color: #006080">"1.0"</span> encoding=<span style="color: #006080">"utf-8"</span>?&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> &lt;RelativeLayout xmlns:android=<span style="color: #006080">"http://schemas.android.com/apk/res/android"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     android:orientation=<span style="color: #006080">"vertical"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span>     android:layout_width=<span style="color: #006080">"fill_parent"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span>     android:layout_height=<span style="color: #006080">"fill_parent"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span>     &lt;ViewFlipper</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span>         android:id=<span style="color: #006080">"@+id/flipper"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span>         android:layout_width=<span style="color: #006080">"fill_parent"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   9:</span>         android:layout_height=<span style="color: #006080">"fill_parent"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  10:</span>         &lt;RelativeLayout xmlns:android=<span style="color: #006080">"http://schemas.android.com/apk/res/android"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  11:</span>             android:orientation=<span style="color: #006080">"vertical"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  12:</span>             android:layout_width=<span style="color: #006080">"fill_parent"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  13:</span>             android:layout_height=<span style="color: #006080">"fill_parent"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  14:</span>             &lt;TextView</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  15:</span>                 android:id=<span style="color: #006080">"@+id/albuminLbl"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  16:</span>                 android:layout_width=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  17:</span>                 android:layout_height=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  18:</span>                 android:text=<span style="color: #006080">"\nAlbumin (g/dL):"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  19:</span>                 android:gravity=<span style="color: #006080">"center_vertical"</span> /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  20:</span>             &lt;EditText</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  21:</span>                 android:id=<span style="color: #006080">"@+id/albumin"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  22:</span>                 android:layout_width=<span style="color: #006080">"fill_parent"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  23:</span>                 android:layout_height=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  24:</span>                 android:singleLine=<span style="color: #006080">"true"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  25:</span>                 android:layout_toRightOf=<span style="color: #006080">"@+id/albuminLbl"</span> /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  26:</span>             &lt;ImageView</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  27:</span>                 android:id=<span style="color: #006080">"@+id/viewInfo"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  28:</span>                 android:layout_width=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  29:</span>                 android:layout_height=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  30:</span>                 android:src=<span style="color: #006080">"@drawable/questionicon"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  31:</span>                 android:layout_below=<span style="color: #006080">"@+id/calc"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  32:</span>                 android:layout_alignParentRight=<span style="color: #006080">"true"</span> /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  33:</span>         &lt;/RelativeLayout&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  34:</span>         &lt;RelativeLayout xmlns:android=<span style="color: #006080">"http://schemas.android.com/apk/res/android"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  35:</span>             android:orientation=<span style="color: #006080">"vertical"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  36:</span>             android:layout_width=<span style="color: #006080">"fill_parent"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  37:</span>             android:layout_height=<span style="color: #006080">"fill_parent"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  38:</span>             &lt;TextView</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  39:</span>                 android:id=<span style="color: #006080">"@+id/calcInfo"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  40:</span>                 android:layout_width=<span style="color: #006080">"fill_parent"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  41:</span>                 android:layout_height=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  42:</span>                 android:text=<span style="color: #006080">"Corrected Calcium = Measured Calcium + (0.8 * (Normal Albumin - Measured Albumin))\nNormal Albumin = 4.0"</span> /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  43:</span>             &lt;ImageView</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  44:</span>                 android:id=<span style="color: #006080">"@+id/done"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  45:</span>                 android:layout_width=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  46:</span>                 android:layout_height=<span style="color: #006080">"wrap_content"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  47:</span>                 android:src=<span style="color: #006080">"@drawable/backicon"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  48:</span>                 android:layout_below=<span style="color: #006080">"@+id/calcInfo"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  49:</span>                 android:layout_alignParentRight=<span style="color: #006080">"true"</span> /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  50:</span>         &lt;/RelativeLayout&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  51:</span>     &lt;/ViewFlipper&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  52:</span> &lt;/RelativeLayout&gt;</pre>
</div>
</div>
<p>In the above code, our ViewFlipper has 2 RelativeLayouts. This allows us to switch between one layout or the other, thereby switching the entire layout’s contents with very little code. In our Java class, we add the following code to bind to our buttons (or in our case, an ImageView):</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> setFlipper(){</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span>     ViewFlipper infoFlipper = (ViewFlipper)findViewById(R.id.flipper);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     infoFlipper.setInAnimation(AnimationUtils.loadAnimation(<span style="color: #0000ff">this</span>, R.anim.push_left_in));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span>     infoFlipper.setOutAnimation(AnimationUtils.loadAnimation(<span style="color: #0000ff">this</span>, R.anim.push_left_out));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span>     final ImageView info = (ImageView)findViewById(R.id.viewInfo);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span>     info.setOnClickListener(<span style="color: #0000ff">new</span> View.OnClickListener() {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span>         <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> onClick(View v)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   9:</span>         {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  10:</span>             infoFlipper.showNext();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  11:</span>         }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  12:</span>     });</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  13:</span>     final ImageView done = (ImageView)findViewById(R.id.done);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  14:</span>     done.setOnClickListener(<span style="color: #0000ff">new</span> View.OnClickListener() {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  15:</span>         <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> onClick(View v)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  16:</span>         {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  17:</span>             infoFlipper.showNext();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  18:</span>         }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  19:</span>     });</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  20:</span> }</pre>
</div>
</div>
<p>After adding our ViewFlipper object, we set a couple of animations on when the view moves in or out (we’ll talk more about this in a second). In addition, we set our onClickListeners to show the next view with infoFlipper.showNext(). This way, when a user clicks the icon, it will slide out the calculator and slide in the equation info.</p>
<p>This can be done either with or without fancy animations. Several animations are included with the Android SDK (SDKpath\samples\ApiDemos\res\anim). To use these, simply copy the animation from the SDK path into your application by creating the res\anim folder and pasting the animation file. Once this is done, you can access the animation like any other resource (such as R.anim.push_left_in). The details in these files can be customized to your liking to add different effects to the animation.</p>
<p>While the above examples are more complicated than doing a single view, it is much easier and saves a lot of typing when compared to making several different intents to display the same information. It also makes the applications look “shiny” which makes the GUI a little more friendly.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/HT81kSmO1l-TaYLminTqqVKZ02M/0/da"><img src="http://feedads.g.doubleclick.net/~a/HT81kSmO1l-TaYLminTqqVKZ02M/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HT81kSmO1l-TaYLminTqqVKZ02M/1/da"><img src="http://feedads.g.doubleclick.net/~a/HT81kSmO1l-TaYLminTqqVKZ02M/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=40mXTfJzQSE:qv7RPIkUUS8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=40mXTfJzQSE:qv7RPIkUUS8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=40mXTfJzQSE:qv7RPIkUUS8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=40mXTfJzQSE:qv7RPIkUUS8:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/40mXTfJzQSE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=32</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=32</feedburner:origLink></item>
		<item>
		<title>Android Programming: AgileMedCalc</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/Ppt1dXXUIW8/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=24#comments</comments>
		<pubDate>Tue, 30 Dec 2008 02:57:36 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Applications]]></category>

		<category><![CDATA[calculator]]></category>

		<guid isPermaLink="false">http://agilemedicine.com/medBlog/?p=24</guid>
		<description><![CDATA[Quick, easy to use specialty applications are fantastic on mobile platforms. However, for some utilities, a single application with multiple functions can save a lot of &#8220;application space&#8221; on menus. To help address this, we&#8217;ve created AgileMedCalc to work as a multi-function medical calculator. We&#8217;ve rolled in one of our past applications, AgileBloodGas, into this [...]]]></description>
			<content:encoded><![CDATA[<p>Quick, easy to use specialty applications are fantastic on mobile platforms. However, for some utilities, a single application with multiple functions can save a lot of &#8220;application space&#8221; on menus. To help address this, we&#8217;ve created <a title="AgileMedCalc" href="http://www.agilemedicine.com/mainsite/main/download#AgileMedCalc" mce_href="http://www.agilemedicine.com/mainsite/main/download#AgileMedCalc" target="_self">AgileMedCalc</a> to work as a multi-function medical calculator. We&#8217;ve rolled in one of our past applications, <a title="AgileBloodGas" href="http://www.agilemedicine.com/mainsite/main/download#AgileBloodGas" mce_href="http://www.agilemedicine.com/mainsite/main/download#AgileBloodGas" target="_self">AgileBloodGas</a>, into this application to cut down on multiple apps for users to download.</p>
<p>With the concept of &#8220;saving space&#8221; in mind, we&#8217;ve also included some animations that will allow users to view details about the calculations being performed on the calculators. A coming post will talk about the animations from the Android platform we used to accomplish this task.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/kOGlIEb1fSLWBpDmc--vI0CkAw4/0/da"><img src="http://feedads.g.doubleclick.net/~a/kOGlIEb1fSLWBpDmc--vI0CkAw4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/kOGlIEb1fSLWBpDmc--vI0CkAw4/1/da"><img src="http://feedads.g.doubleclick.net/~a/kOGlIEb1fSLWBpDmc--vI0CkAw4/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=Ppt1dXXUIW8:Z7FmzoDLor8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=Ppt1dXXUIW8:Z7FmzoDLor8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=Ppt1dXXUIW8:Z7FmzoDLor8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=Ppt1dXXUIW8:Z7FmzoDLor8:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/Ppt1dXXUIW8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=24</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=24</feedburner:origLink></item>
		<item>
		<title>Android Programming: Google Service/App Authentication</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/1wB6rne_Mgs/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=22#comments</comments>
		<pubDate>Wed, 24 Dec 2008 03:14:03 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Android programming]]></category>

		<category><![CDATA[Applications]]></category>

		<category><![CDATA[authentication]]></category>

		<category><![CDATA[defaulthttpclient]]></category>

		<category><![CDATA[google servicelogin]]></category>

		<category><![CDATA[httppost]]></category>

		<category><![CDATA[namevaluepair]]></category>

		<guid isPermaLink="false">http://agilemedicine.com/medBlog/?p=22</guid>
		<description><![CDATA[While many of the Google applications already have Android-based ports, some of the more “specialty apps” such as AdSense don’t have a mobile interface. Luckily, the Google API allows for an easy login method using an HTTP Post request. One of our current applications, SimpleAdMonitor, uses this method to download an AdSense user’s daily and [...]]]></description>
			<content:encoded><![CDATA[<p>While many of the Google applications already have Android-based ports, some of the more “specialty apps” such as AdSense don’t have a mobile interface. Luckily, the Google API allows for an easy login method using an HTTP Post request. One of our current applications, <a title="SimpleAdMonitor" href="http://www.agilemedicine.com/mainsite/main/download#SimpleAdMonitor" target="_blank">SimpleAdMonitor</a>, uses this method to download an AdSense user’s daily and all time totals.</p>
<p>While the solution is fairly easy to implement, the actual POST request appears to run quite slowly, at least over the Android emulator and somewhat on the device as well.</p>
<p>The first step to generating an authorized session is to post the user’s login details to the Google ServiceLogin:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; max-height: 200px;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> String login = <span style="color: #006080">"https://www.google.com/accounts/ServiceLoginAuth?service=adsense&amp;hl=en-US&amp;ltmpl=login&amp;ifr=true&amp;passive=true&amp;rm=hide&amp;nui=3&amp;alwf=true&amp;continue=https%3A%2F%2Fwww.google.com%2Fadsense%2Fgaiaauth&amp;followup=https%3A%2F%2Fwww.google.com%2Fadsense%2Fgaiaauth"</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> DefaultHttpClient client = <span style="color: #0000ff">new</span> DefaultHttpClient();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span> String websiteData = <span style="color: #0000ff">null</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span> URI uri = <span style="color: #0000ff">new</span> URI(login);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span> HttpPost method = <span style="color: #0000ff">new</span> HttpPost(uri);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span> method.addHeader(<span style="color: #006080">"User-Agent"</span>, <span style="color: #006080">"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10"</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span> method.addHeader(<span style="color: #006080">"Pragma"</span>, <span style="color: #006080">"no-cache"</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span> method.addHeader(<span style="color: #006080">"Content-Type"</span>, <span style="color: #006080">"application/x-www-form-urlencoded"</span>);</pre>
</div>
</div>
<p>On line 1, the address specifies a Google service to authorize against. This service can be changed if you need to access some other application. Once this request is formed, the user’s login information can be added using a <a href="http://code.google.com/android/reference/org/apache/http/NameValuePair.html" target="_blank">NameValuePair</a> list. These are then set on the HttpPost method using setEntity:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; max-height: 200px;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> List &lt;NameValuePair&gt; loginInfo = <span style="color: #0000ff">new</span> ArrayList &lt;NameValuePair&gt;();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> loginInfo.add(<span style="color: #0000ff">new</span> BasicNameValuePair(<span style="color: #006080">"Email"</span>, username));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span> loginInfo.add(<span style="color: #0000ff">new</span> BasicNameValuePair(<span style="color: #006080">"Passwd"</span>, password));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span> loginInfo.add(<span style="color: #0000ff">new</span> BasicNameValuePair(<span style="color: #006080">"null"</span>, <span style="color: #006080">"Sign+in"</span>));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span> HttpEntity entity = <span style="color: #0000ff">new</span> UrlEncodedFormEntity(nvps, HTTP.UTF_8);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span> method.setEntity(entity);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span> HttpResponse res = client.execute(method);</pre>
</div>
</div>
<p>One item to note on line 3 is that the param used for the password is “Passwd”. Once this data is posted, the server will return a response that should be evaluated for a correct login. If the login is valid, the page should respond with a link to a redirect page that needs to again be posted to:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; max-height: 200px;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> String login2 = <span style="color: #006080">"https://www.google.com/accounts/CheckCookie?continue=https%3A%2F%2Fwww.google.com%2Fadsense%2Fgaiaauth&amp;followup=https%3A%2F%2Fwww.google.com%2Fadsense%2Fgaiaauth&amp;hl=en-US&amp;service=adsense&amp;ltmpl=login&amp;chtml=LoginDoneHtml"</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> method.setURI(<span style="color: #0000ff">new</span> URI(login2));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span> res = client.execute(method);</pre>
</div>
</div>
<p>At this point, the server should respond with the data from the redirect URL, in this case, the main AdSense page. Further requests can now be made to the server using the same method without needing to re-authorize the user. As I mentioned previously, there are some latency issues with this method that I haven’t quite sorted out yet. The lag isn’t horrible, but is fairly significant when waiting for two fairly small pieces of data. Some additional digging will hopefully find out what is causing the delay and how to improve it.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/-bzxk2OSuRETzwkDTOi-JPYpX18/0/da"><img src="http://feedads.g.doubleclick.net/~a/-bzxk2OSuRETzwkDTOi-JPYpX18/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-bzxk2OSuRETzwkDTOi-JPYpX18/1/da"><img src="http://feedads.g.doubleclick.net/~a/-bzxk2OSuRETzwkDTOi-JPYpX18/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=1wB6rne_Mgs:o_HR04KMggM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=1wB6rne_Mgs:o_HR04KMggM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=1wB6rne_Mgs:o_HR04KMggM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=1wB6rne_Mgs:o_HR04KMggM:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/1wB6rne_Mgs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=22</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=22</feedburner:origLink></item>
		<item>
		<title>Android Programming: DefaultHttpClient GET Request</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/HS8i8Ct7Y2c/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=21#comments</comments>
		<pubDate>Wed, 17 Dec 2008 05:39:24 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android programming]]></category>

		<category><![CDATA[Android]]></category>

		<category><![CDATA[defaulthttpclient]]></category>

		<category><![CDATA[httpget]]></category>

		<guid isPermaLink="false">http://agilemedicine.com/medBlog/?p=21</guid>
		<description><![CDATA[This article will briefly describe the method to form and receive an HTTP GET request in Android. The first code snippet listed below shows how to form the request and receive the data back from the server.  The second shows a function that can be used to read the InputStream and save it to a [...]]]></description>
			<content:encoded><![CDATA[<p>This article will briefly describe the method to form and receive an HTTP GET request in Android. The first code snippet listed below shows how to form the request and receive the data back from the server.  The second shows a function that can be used to read the InputStream and save it to a string. The entire process isn’t very difficult, but can be a bit confusing the first time you try to piece it together. The code below still requires some additional code to fail more elegantly in case of a broken internet connection, website error, etc., but should copy/paste pretty easily into applications.</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; max-height: 200px;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">String </span>getUrlData(String url) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span>     String websiteData = <span style="color: #0000ff">null</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">try</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span>         DefaultHttpClient client = <span style="color: #0000ff">new</span> DefaultHttpClient();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span>         URI uri = <span style="color: #0000ff">new</span> URI(url);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span>         HttpGet method = <span style="color: #0000ff">new</span> HttpGet(uri);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span>         HttpResponse res = client.execute(method);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span>         InputStream data = res.getEntity().getContent();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   9:</span>         websiteData = generateString(data);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  10:</span>     } <span style="color: #0000ff">catch</span> (ClientProtocolException e) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  11:</span>         <span style="color: #008000">// TODO Auto-generated catch block</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  12:</span>         e.printStackTrace();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  13:</span>     } <span style="color: #0000ff">catch</span> (IOException e) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  14:</span>         <span style="color: #008000">// TODO Auto-generated catch block</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  15:</span>         e.printStackTrace();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  16:</span>     } <span style="color: #0000ff">catch</span> (URISyntaxException e) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  17:</span>         <span style="color: #008000">// TODO Auto-generated catch block</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  18:</span>         e.printStackTrace();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  19:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  20:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  21:</span>     <span style="color: #0000ff">return websiteData</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  22:</span> }</pre>
</div>
</div>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4; max-height: 200px;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> String generateString(InputStream stream) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span>     InputStreamReader reader = <span style="color: #0000ff">new</span> InputStreamReader(stream);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     BufferedReader buffer = <span style="color: #0000ff">new</span> BufferedReader(reader);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span>     StringBuilder sb = <span style="color: #0000ff">new</span> StringBuilder();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span>     <span style="color: #0000ff">try</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span>         String cur;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span>         <span style="color: #0000ff">while</span> ((cur = buffer.readLine()) != <span style="color: #0000ff">null</span>) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   9:</span>             sb.append(cur + <span style="color: #006080">"\n"</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  10:</span>         }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  11:</span>     } <span style="color: #0000ff">catch</span> (IOException e) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  12:</span>         <span style="color: #008000">// TODO Auto-generated catch block</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  13:</span>         e.printStackTrace();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  14:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  15:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  16:</span>     <span style="color: #0000ff">try</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  17:</span>         stream.close();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  18:</span>     } <span style="color: #0000ff">catch</span> (IOException e) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  19:</span>         <span style="color: #008000">// TODO Auto-generated catch block</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  20:</span>         e.printStackTrace();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  21:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  22:</span>     <span style="color: #0000ff">return</span> sb.toString();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  23:</span> }</pre>
</div>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/QVAGHraOd83n5LlEzkpvHgDtqus/0/da"><img src="http://feedads.g.doubleclick.net/~a/QVAGHraOd83n5LlEzkpvHgDtqus/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QVAGHraOd83n5LlEzkpvHgDtqus/1/da"><img src="http://feedads.g.doubleclick.net/~a/QVAGHraOd83n5LlEzkpvHgDtqus/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=HS8i8Ct7Y2c:zXZWUEtiADQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=HS8i8Ct7Y2c:zXZWUEtiADQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=HS8i8Ct7Y2c:zXZWUEtiADQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=HS8i8Ct7Y2c:zXZWUEtiADQ:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/HS8i8Ct7Y2c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=21</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=21</feedburner:origLink></item>
		<item>
		<title>Application Development: AgileBloodGas</title>
		<link>http://feedproxy.google.com/~r/agilemedicine/~3/ROOQnffOY90/</link>
		<comments>http://www.agilemedicine.com/medBlog/?p=17#comments</comments>
		<pubDate>Mon, 15 Dec 2008 19:12:50 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
		
		<category><![CDATA[Android]]></category>

		<category><![CDATA[Applications]]></category>

		<category><![CDATA[blood gas]]></category>

		<guid isPermaLink="false">http://agilemedicine.com/medBlog/?p=17</guid>
		<description><![CDATA[The AgileBloodGas application was developed as an acid/base status calculator. The most time consuming part of developing this application was some of the error checking and equation entry. The paper used as a basis for the equations was Morganroth, M. 1990. Six steps to acid-base analysis: Clinical applications. The Journal of Critical Illness 5:460-469.
. This [...]]]></description>
			<content:encoded><![CDATA[<p>The <a title="AgileBloodGas" href="http://www.agilemedicine.com/mainsite/main/download#AgileBloodGas" target="_blank">AgileBloodGas</a> application was developed as an acid/base status calculator. The most time consuming part of developing this application was some of the error checking and equation entry. The paper used as a basis for the equations was <strong>Morganroth, M. 1990. Six steps to acid-base analysis: Clinical applications. The Journal of Critical Illness 5:460-469.<br />
</strong>. This is an excellent paper to read for anyone who deals with arterial blood gases on a regular basis.</p>
<p>One major improvement that can be made to this application yet is an on-screen method of data entry, rather than needing to flip out the keyboard. This will hopefully be solved either with a future application update from us or a soft keyboard in a future Android release.</p>
<p>In addition, we hope to incorporate this into a larger medical calculator at some point in the future to make it more applicable to a wider range of audiences, rather than having a specific application for each individual equation.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/3qUhsoDgy1MOTje9qOaEY0JVJQw/0/da"><img src="http://feedads.g.doubleclick.net/~a/3qUhsoDgy1MOTje9qOaEY0JVJQw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3qUhsoDgy1MOTje9qOaEY0JVJQw/1/da"><img src="http://feedads.g.doubleclick.net/~a/3qUhsoDgy1MOTje9qOaEY0JVJQw/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/agilemedicine?a=ROOQnffOY90:sIOtB15sK0U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=ROOQnffOY90:sIOtB15sK0U:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/agilemedicine?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/agilemedicine?a=ROOQnffOY90:sIOtB15sK0U:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/agilemedicine?i=ROOQnffOY90:sIOtB15sK0U:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/agilemedicine/~4/ROOQnffOY90" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.agilemedicine.com/medBlog/?feed=rss2&amp;p=17</wfw:commentRss>
		<feedburner:origLink>http://www.agilemedicine.com/medBlog/?p=17</feedburner:origLink></item>
	</channel>
</rss>
