<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1756956114470319563</id><updated>2024-09-15T00:41:03.200-04:00</updated><category term="Android"/><category term="Eclipse"/><category term="Java"/><category term="Admob"/><category term="Beautiful Code"/><category term="GAE"/><category term="Google Apps Engine"/><category term="Google Code"/><category term="Logcat"/><category term="Mercurial"/><category term="Push Notifications"/><category term="Resource Qualifiers"/><category term="bug"/><category term="design"/><category term="tips"/><category term="zone"/><title type='text'>Java and the N00b</title><subtitle type='html'>Follow me as I learn to code(mostly java and android). I will share tips that I couldn&#39;t find myself by google-ing.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-4789811580689686229</id><published>2011-04-24T19:23:00.000-04:00</published><updated>2011-04-24T19:23:29.163-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="GAE"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Apps Engine"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Push Notifications"/><title type='text'>Simple Backends for Android Apps - Part 1</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In my recent lunacy I decided to take up my friends offer and work with him on a multiplayer android game. It&#39;s a dice game, but we hope that people will give it a chance since it&#39;s very addicting. I&#39;m currently suffering from Feature Rampage, and I&#39;m deciding to add complex features before I&#39;m done implementing simpler ones. It&#39;s a terrible business practice but considering that we specified no budget for this and that we are doing this part time, I don&#39;t care ;) One of the features that I decided to implement was online play (including friends and chats)! It&#39;s pretty ambitious considering this is going to be the first product I ever made and that I don&#39;t know any html, http or any other language besides Java. What can I say? I learn best by doing : D&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; For this post I won&#39;t dabble too much into the details of the framework, instead I&#39;m going to provide an overview and explain how I implemented push notification for android versions 1.6+.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Since we already established that I&#39;m a n00b at everything (I dropped the hint in the Blog name btw) I set out on Google&#39;s Blue, Green, Yellow, and Red road to find the right assets for me and my current needs. My criteria was simplicity, reliability and speed. Simplicity because I want to release this app before I get out of&amp;nbsp;High School, so while I would love to read and learn about new technologies it wouldn&#39;t fit the schedule. I wanted reliability because I didn&#39;t want to re write the whole app because I chose the wrong service; I would rather take my time choosing that waste my time switching services. And lastly I wanted Speed because frankly who likes to use slow, unresponsive apps?&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Still here? I&#39;m surprised you care that much!...erhmm....right!&amp;nbsp;backends...I happened to mention that I wanted push notifications. I basically want to avoid polling for anything. I&#39;d Rather put a load on a server than on a user&#39;s phone. I couldn&#39;t use Android&#39;s&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&lt;a href=&quot;http://code.google.com/android/c2dm/index.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;C2DM&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;because I would be leaving&amp;nbsp;&lt;a href=&quot;http://developer.android.com/resources/dashboard/platform-versions.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;almost 30% of Android Users&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;without Push, so XMPP ( or Jabber for you old timers) seemed like the perfect match up for me. After all, C2DM is based off of XMPP! I just needed to copy it.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; I set out to make my own XMPP server and after numerous failed&amp;nbsp;attempts&amp;nbsp;I found this wonderful service called&amp;nbsp;&lt;a href=&quot;http://www.xtify.com/video-demo&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;XTIFY&lt;/span&gt;&lt;/a&gt;. It was a blessing! Saved me a ton of work and I have not had a single dropped notification. Don&#39;t be fooled, while the site heavily pushes developers to use their pre-made Notification Activity you can send a &quot;custom&quot; notification with your own custom intent in it. Like so:&lt;br /&gt;
&lt;br /&gt;
In XTIFY you can add your custom intent&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7AOo671KuydRjbOYnUT9jhHN28C_xXcv_qf0Q3VHGyc2r-FHpClPBale_L7qH7y406tNOPGDp7a65Q5Yy-T_3KPKvXYxQt8IiQ_XSW6-yMt0pNN0aRqTGQsglvIwP5oFm20Ghu-S8-gQ/s1600/xtify+notification+console.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7AOo671KuydRjbOYnUT9jhHN28C_xXcv_qf0Q3VHGyc2r-FHpClPBale_L7qH7y406tNOPGDp7a65Q5Yy-T_3KPKvXYxQt8IiQ_XSW6-yMt0pNN0aRqTGQsglvIwP5oFm20Ghu-S8-gQ/s400/xtify+notification+console.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
And in your code add this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkuGR9ldqs4LPJjKKsKE8zI361pJpXC98MBIbEyQ_ERcVVkbpH_Th24jkUK6QXMWQ31d3ACeYZBeLtPr4ERCAmYi-2PFxiZ6d64OB__LCRWHFU1KC9rg5YPxriDWf5JdUDIHuqozzDBsE/s1600/code.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;303&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkuGR9ldqs4LPJjKKsKE8zI361pJpXC98MBIbEyQ_ERcVVkbpH_Th24jkUK6QXMWQ31d3ACeYZBeLtPr4ERCAmYi-2PFxiZ6d64OB__LCRWHFU1KC9rg5YPxriDWf5JdUDIHuqozzDBsE/s400/code.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Btw this is assuming you followed the&amp;nbsp;&lt;a href=&quot;http://console.xtify.com/implementation-guide-android&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;implementation guide&lt;/span&gt;&lt;/a&gt;&amp;nbsp;(which is fairly good!)&lt;br /&gt;
&lt;br /&gt;
From this central Broadcast Receiver I can organize and send intents to other activities, write to databases and just treat this like a response from a server without having to deal with stupid http requests. That&#39;s going to come in the next part of this series ;)</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/4789811580689686229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/04/simple-backends-for-android-apps-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/4789811580689686229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/4789811580689686229'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/04/simple-backends-for-android-apps-part-1.html' title='Simple Backends for Android Apps - Part 1'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7AOo671KuydRjbOYnUT9jhHN28C_xXcv_qf0Q3VHGyc2r-FHpClPBale_L7qH7y406tNOPGDp7a65Q5Yy-T_3KPKvXYxQt8IiQ_XSW6-yMt0pNN0aRqTGQsglvIwP5oFm20Ghu-S8-gQ/s72-c/xtify+notification+console.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-92456319341459365</id><published>2011-04-16T14:28:00.001-04:00</published><updated>2011-04-16T14:30:34.280-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="bug"/><title type='text'>Android Animation Bug</title><content type='html'>After much head bashing I have found a bug in Android. Now I wouldn&#39;t be posting it here if I thought it was a big enough bug but I&#39;m sure most of you will encounter it if your using the android.view.animation package. I&#39;m also positive it&#39;s a bug because there are tons and tons of animationListener questions on StackOverflow. So there are many variable to make this bug happen so I won&#39;t go into the procedures to recreate it. I&#39;m going to keep it Short and Simple and tell you this. If you ever do this:&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;Animation a = AnimationUtils.loadAnimation(this,R.anim.translate_animation);&lt;br /&gt;
a.setAnimationListener(new AnimationListener(){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@Override&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;public void &lt;b&gt;onAnimationEnd&lt;/b&gt;(Animation animation) {}&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@Override&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;public void &lt;b&gt;onAnimationRepeat&lt;/b&gt;(Animation animation) {}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;@Override&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;public void &lt;b&gt;onAnimationStart&lt;/b&gt;(Animation animation) {}&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;}&lt;/span&gt;);&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;And you figure out eventually that any of the onAnimation* methods never get called, then you ran into the bug.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;So far the only solution that I found was to make a subclass of the view that you&#39;re using and override the onAnimationEnd method with whatever you want to do. Like&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/4750939/android-animation-is-not-finished-in-onanimationend&quot;&gt;this&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Shoutout to Matt Quigley. He&#39;s a software engineer that works on mobile phones. Follow his blog and his excitement on&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #999999; font-family: &#39;Trebuchet MS&#39;, Trebuchet, Arial, Verdana, sans-serif; font-size: 10px; font-weight: bold; letter-spacing: 1px; line-height: 16px; text-transform: uppercase;&quot;&gt;&lt;/span&gt;&lt;a href=&quot;http://www.androidengineer.com/&quot;&gt;Android Engineer&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/92456319341459365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/04/android-animation-bug.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/92456319341459365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/92456319341459365'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/04/android-animation-bug.html' title='Android Animation Bug'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-3978534419764994540</id><published>2011-04-16T12:21:00.000-04:00</published><updated>2011-04-16T12:21:11.230-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="design"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="tips"/><category scheme="http://www.blogger.com/atom/ns#" term="zone"/><title type='text'>Design before Code</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;There&#39;s this image of the ultimate programmer that no doubt, at least, will flash through the newbie programmers mind. He&#39;s a genius, no doubt wearing glasses, he writes code by himself, he doesn&#39;t write bugs--ever, and he doesn&#39;t plan before coding (after all the code he excrements exceed the value of&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/John_D._Carmack&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;John Carmack&#39;s&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;code)&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;. &lt;/span&gt;Now the first quality surely helps at programming but the rest are superfluous or just plain wrong. No one cares if you wear glasses or not. EVERYONE makes bugs, its natural because we&#39;re human beings and we make mistakes. And (depending on the size of the project) no one-I repeat- NO ONE can code all alone or start coding before designing a good bit of the structure.&lt;br /&gt;
&lt;br /&gt;
Today I&#39;ll talk about the designing part of&amp;nbsp;programming. I&#39;m working on a dice game for Android and during the early stages of the game I made a class that you send an int Array (int[]) and it will return the highest score possible of that group of dice. While I was designing the class, it&amp;nbsp;occurred&amp;nbsp;to me that it was the perfect situation to use a&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&lt;a href=&quot;http://www.glenmccl.com/perfj_025.htm&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;Final Class&lt;/span&gt;&lt;/a&gt;. &lt;/span&gt;There was no instance dependency anywhere in the class and all the methods could have easily been static. BUT!, being the lazy person that I am I decided to make a regular class that used variables to keep track of the number of dice face values i.e. numOf1 = 3 implies that in the array there are 3 ones. During the development I kept having to change a lot of the code of the other classes to&amp;nbsp;accommodate&amp;nbsp;for the shortcomings of the class. For example, I forgot that since I used 1 instance the state of the variables were never reset to 0 after the class calculated the score of an Array. Little mistakes like these forced to make the class Final and all the methods in it static, which looking at it now makes the whole project A LOT easier.&lt;br /&gt;
&lt;br /&gt;
What Am I driving at here? Well basically, all that hardship could have been avoided if instead of being lazy I stopped coding for a moment and thought about the future of the project. But I didn&#39;t. I love to code and while I was coding I was in the&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&lt;a href=&quot;http://www.computus.org/journal/?p=982&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;ZONE&lt;/span&gt;&lt;/a&gt;. &lt;/span&gt;You know how it is. Its like a vice. You feel omnipotent. I did and I didn&#39;t want to stop to think about the design of the structure. And it cost me. Getting in the zone is often regarded as when you get the most work done or the most important work done. Sometimes getting out of the zone and into design mode can help a lot more.&lt;br /&gt;
&lt;br /&gt;
My shout out for this post goes to &lt;a href=&quot;http://www.joelonsoftware.com/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;Joel Polsky&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&amp;nbsp;&lt;/span&gt;who works at Fog Creek Software. He&#39;s very a very smart down to earth man who&#39;s blog post give a lot of advice based on a good bit of experience.&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&lt;a href=&quot;http://www.joelonsoftware.com/articles/fog0000000043.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;This&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;blog post should speak for him better than I ever will be able to ;-) Until next time. Follow me on twitter&amp;nbsp;&lt;a href=&quot;http://twitter.com/tytdfn&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;@tytdfn&lt;/span&gt;&lt;/a&gt;&amp;nbsp;to send me suggestions or questions.</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/3978534419764994540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/04/design-before-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/3978534419764994540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/3978534419764994540'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/04/design-before-code.html' title='Design before Code'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-3402718196044188773</id><published>2011-04-09T15:56:00.001-04:00</published><updated>2011-04-09T15:57:15.633-04:00</updated><title type='text'>More on Hg (Aka Mercurial for Dummies)</title><content type='html'>Remember that tutorial&amp;nbsp;&lt;a href=&quot;http://jandn00b.blogspot.com/2011/03/easy-android-app-project-hosting-with.html&quot; style=&quot;color: purple;&quot;&gt;on Easy App Project Hosting?&lt;/a&gt;&amp;nbsp;&amp;nbsp;Yeah well if you followed it, I basically tricked you into implementing Code Revision software into your project. It&#39;s a good practice since it enables you to&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Share your code easily&lt;/li&gt;
&lt;li&gt;Work with other programmers at the same time&lt;/li&gt;
&lt;li&gt;Fix any mistake by reverting back to old versions of files&lt;/li&gt;
&lt;li&gt;Keep you code backed up&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;And if you followed the tutorial to the letter, you&#39;re currently using Mercurial (or Hg) as your code revision control system. Allow me to explain myself further. IFF (if and only if for those math noobs) you don&#39;t care and want a quick crash course on Hg scroll down.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;BIG WARNING: If you choose to use Google code for project hosting remember that anyone in the world can look up your code. Google code is only suitable for Open Source Projects&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;1. Share your code easily&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;For someone to take a look at your code its as easy as &quot;hg clone [url]&quot;&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;This command will download the whole project located at [url] and make a local copy on the users computer. The user will even be able to make changes to the code and commit to their local repository.&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;Make branches so your work and your&amp;nbsp;colleague(s) work is separated.&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;It&#39;s still easy to see each other codes, especially if you use Mercurial Eclipse. To make a branch go to your project, right click on the project Team&amp;gt;Add Branch. To see the work of your&amp;nbsp;colleague(s)on another branch right click on your project again and Team&amp;gt;Switch To&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;Wanna take a peak at the code from anywhere in the world?&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;Your code can be viewed directly from your Google Project website in case you brainstorming a problem and you want to refresh your memory.&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Before I move to point #2 I want to point out that this sounds like a really generic attempt to promote these services. I&#39;m not affiliated with any of these companies, I just love using these tools so much that I feel like blogging about it. I guess thats enough to classify me as a nerd hehe.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;2. Work with other Programmers at the same time&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;How is this possible you might ask? Well Hg has this cool feature called merge. You and your&amp;nbsp;colleague(s) can work on one thing at the same time (even in the same branch) and when it comes time to join your work together, you use the merge tool. The merge tool works like this&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Import the work you want to merge.&lt;/li&gt;
&lt;li&gt;Use the merge command. Either through a command line (hg merge) or by Team&amp;gt;Merge&lt;/li&gt;
&lt;li&gt;When there are conflicts choose which files/parts to keep. Some Scenarios include&lt;/li&gt;
&lt;ol&gt;&lt;li&gt;Keep file a ,b and choose your colleagues(s) c&lt;/li&gt;
&lt;li&gt;Keep file a, use your&amp;nbsp;colleagues(s) b, and use method 3 from your&amp;nbsp;colleague(s) c file instead of your own.&lt;/li&gt;
&lt;li&gt;Your&amp;nbsp;colleague(s) is a genius keep all his files and cry yourself at night&lt;/li&gt;
&lt;/ol&gt;&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;3. Fix any mistake by reverting back to old file revisions.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Oops wrote 300 lines and I broke the build. Hmmmm I don&#39;t feel like going through all of the code again. It came out kinda messy. Geee I wish I could just turn back time and start over from where i left the code off yesterday....WAIT A DARN MINUTE! I can just right click on the said file and &amp;nbsp;Team&amp;gt;Revert to yesterdays revision of the file hehehe. Sweeeet! Now I can pretend to bug track while I look at some youtube videos....&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;4.&amp;nbsp;Keep you code backed up&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;NOOOOOOoooooo! I accidently deleted the project yesterday after that crazy party....beer and programming don&#39;t mix....oh yeah I pushed all my changes up the google code project site. Now just File&amp;gt;Import&amp;gt;Mercurial&amp;gt;Clone Existing Mercurial Repository . Ok while that loads I can just.....oh its done.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Hopefully that illustrates why a modern programmer would LOVE code revision control. I know I do. Heres some helpful hints&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;----------------STOP SCROLLING HERE IF YOU WERE TOO LAZY TO READ MY POST----------&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Quick Explanations of Commands:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Pull - &quot;pulls&quot; in new versions of the code&lt;/div&gt;&lt;div&gt;Update - overwrites old code version with new code version&lt;/div&gt;&lt;div&gt;Commit - save the state of your code to your local repository&lt;/div&gt;&lt;div&gt;Push - &quot;push&quot; all the commits up to your project hosting website&lt;/div&gt;&lt;div&gt;Synchronize - check to see if there are any new code revisions in the project hosting website&lt;/div&gt;&lt;div&gt;Merge - to merge you need to have different versions of the same file in your local repository -or- choose to merge with another branch.&lt;/div&gt;&lt;div&gt;Add Branch - pretty self explanatory...except I would like to add that branches are very useful&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Also I&#39;m starting to refer you to other cool programming blogs. I&#39;ll start with Kaloer. He&#39;s a very respected android developer and I hope to make blog posts as useful as his in the future.&amp;nbsp;&lt;a href=&quot;http://www.kaloer.com/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;Click here for his blog&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/3402718196044188773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/04/more-on-hg-aka-mercurial-for-dummies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/3402718196044188773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/3402718196044188773'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/04/more-on-hg-aka-mercurial-for-dummies.html' title='More on Hg (Aka Mercurial for Dummies)'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-7161054087735791744</id><published>2011-03-30T19:16:00.006-04:00</published><updated>2011-03-31T15:51:21.105-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Beautiful Code"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Beautiful Code: Pt. 1</title><content type='html'>&lt;div style=&quot;text-align: center;&quot;&gt;***I&#39;m starting this new series which will highlight code that I think is pretty/gorgeous/mind-blowing or all of the above. Generally it will be simple cases, and most of it will be Java only because of my limited knowledge of coding languages. Feel free to submit code to me (Using&amp;nbsp;&lt;a href=&quot;http://pastie.org/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;Pastie&lt;/span&gt;&lt;/a&gt;&amp;nbsp;works best I believe) or to correct code highlighted in these segments.***&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;u&gt;findPairs()&lt;/u&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;br /&gt;
&lt;/u&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;I&#39;m making a dice game for android with a close friend of mine. The game is called&amp;nbsp;&lt;a href=&quot;http://www.farklerules.com/the-rules-of-farkle/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;Farkle&lt;/span&gt;&lt;/a&gt;&amp;nbsp;and its highly addictive. A player needs to roll 6 die and choose the best combinations to score the most points. This method I just created will return the positions of other dice with the same value. The method came out very clean and I&#39;m extremely proud of it. Even if it&#39;s extremely simple&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;public int[] findPairs(int index, int value) {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;int[] dirtyArray = { 0, 0, 0, 0, 0, 0 };&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;int count = 0;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; for (int j = 0; j &amp;lt; dieValues.length; j++) {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (j != index &amp;amp;&amp;amp; dieValues[j] == value) {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dirtyArray[count++] = j;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (count == -1) &amp;nbsp; &amp;nbsp;&amp;nbsp;return null;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int[] cleanArray = new int[count];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.arraycopy(dirtyArray, 0, cleanArray, 0, count);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; return cleanArray;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Edit: Teehee made a mistake and just found it. Guess that&#39;s what happens when you post &quot;Beautiful&quot; code before testing. Note to self: variable++ returns the variable before it got incremented&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Double Edit: And another one! It&#39;s perfect now (I promise)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/7161054087735791744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/03/beautiful-code-pt-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/7161054087735791744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/7161054087735791744'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/03/beautiful-code-pt-1.html' title='Beautiful Code: Pt. 1'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-6679321686300525349</id><published>2011-03-27T21:32:00.002-04:00</published><updated>2011-03-31T15:34:51.127-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Admob"/><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Logcat"/><title type='text'>Another Reason for Admob Ad&#39;s to not load and the Virtues of the Logcat</title><content type='html'>The Admob library for Android can be a bit of a pain to get it to work sometimes. Today I learned a valuable lesson: Don&#39;t put padding on the Layout where the ad will go OR THE AD WON&#39;T SHOW UP. Unless you know how to use the logcat for android, this will be a very hard problem to solve.&lt;br /&gt;
&lt;br /&gt;
Since were on the topic of logcat &amp;nbsp;here&#39;s a helpful hint if you&#39;re using Eclipse. Instead of opening up a cmd (command) line to look at the logcat and typing in &quot;adb devices&quot; then &quot;abd shell&quot; then &quot;logcat&quot;just go to Eclipse&lt;br /&gt;
&lt;br /&gt;
Window&amp;gt;Show View&amp;gt;Other&amp;gt; then look under the Android Tab and double click on the Logcat View And viola!</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/6679321686300525349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/03/another-reason-for-admob-ads-to-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/6679321686300525349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/6679321686300525349'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/03/another-reason-for-admob-ads-to-not.html' title='Another Reason for Admob Ad&#39;s to not load and the Virtues of the Logcat'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-6811999008011930563</id><published>2011-03-23T18:22:00.004-04:00</published><updated>2011-04-02T18:32:00.850-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Code"/><category scheme="http://www.blogger.com/atom/ns#" term="Mercurial"/><title type='text'>Easy Android App Project Hosting with Eclipse and Google Code</title><content type='html'>One of the things I love about Google is all the different kinds of services that they offer to users, and the fact that I only need to remember my Gmail login to access all those features. One service I find particularly useful is Google code. It allows me to develop on different work stations and also helps me and my coding friend(s) keep connected no matter where we are.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This tutorial expects Android and Eclipse to be installed on the system.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;So if your interested comon&#39; and follow me. I&#39;ll Show Ya!&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;1. Set up a project.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Go&amp;nbsp;&lt;a href=&quot;http://code.google.com/hosting/createProject&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;Here&lt;/span&gt;&lt;/a&gt;&amp;nbsp;and make a new project. *Choose the version control as Mercurial* &amp;lt;-very important&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MFhmPASvS22aILPmweALD3sfGrsVe353LSN1ad8apdRlAt1h24uRU-yyGt4rq33v8FARYH0WkTP6N0Ry0CLumrPMRTAWUlhu0-UEGVrxMG8iyap5XJTGM_Uo56wdSzDhjy3FyPwku08/s1600/setting+up+project.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MFhmPASvS22aILPmweALD3sfGrsVe353LSN1ad8apdRlAt1h24uRU-yyGt4rq33v8FARYH0WkTP6N0Ry0CLumrPMRTAWUlhu0-UEGVrxMG8iyap5XJTGM_Uo56wdSzDhjy3FyPwku08/s400/setting+up+project.png&quot; width=&quot;395&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;2. Create a new Android App Project in Eclipse&lt;br /&gt;
3.Install the Mercurial Eclipse Plug-in&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Copy this URL: &amp;nbsp;&lt;a href=&quot;http://cbes.javaforge.com/update&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #f3f3f3;&quot;&gt;http://cbes.javaforge.com/update&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Put it in the ADD field (1)&lt;/li&gt;
&lt;li&gt;Check Mercurial Eclipse (2)&lt;/li&gt;
&lt;li&gt;Next(3)&lt;/li&gt;
&lt;li&gt;Accept and Click next&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZLOoWp8pIT_EizyYmr6ubcnwZLzxpsFGpZM_RDx4Tfj0sPXD6JSASdB2QHAj1kaC8dAKG4JKaqCeF6n18TMMA4qadyZFYlWQCnCGzIi87G3H7EbJ_mBnQV_K3lT1PajGLOhPNX7i11aA/s1600/available+software+screen.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;381&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZLOoWp8pIT_EizyYmr6ubcnwZLzxpsFGpZM_RDx4Tfj0sPXD6JSASdB2QHAj1kaC8dAKG4JKaqCeF6n18TMMA4qadyZFYlWQCnCGzIi87G3H7EbJ_mBnQV_K3lT1PajGLOhPNX7i11aA/s400/available+software+screen.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;4.Make a local Repository&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Right Click on the new Android App Project (1)&lt;/li&gt;
&lt;li&gt;Team (2)&lt;/li&gt;
&lt;li&gt;Share Project (3)&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekrqqbEm5E-s6FLUNK54kUsU6Jx3bAUTMpSFaO7io4uZVaPO3Logd8l6bxmmto6he21E61GfW62ymcE2gwvqyCCmWd3ALLmzmlLvgz6whdgAerc5xbo3LQlbmPeuqd0c2HGcHxq8Y8pE/s1600/team+share+project.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekrqqbEm5E-s6FLUNK54kUsU6Jx3bAUTMpSFaO7io4uZVaPO3Logd8l6bxmmto6he21E61GfW62ymcE2gwvqyCCmWd3ALLmzmlLvgz6whdgAerc5xbo3LQlbmPeuqd0c2HGcHxq8Y8pE/s400/team+share+project.png&quot; width=&quot;325&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Click On Mercurial&lt;/li&gt;
&lt;li&gt;Next&lt;/li&gt;
&lt;li&gt;Click on Next until you can click on Finish&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;5. Synchronize with the Goggle Project you set up in the first step.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Go to the homepage of the Project. Click on Source&lt;/li&gt;
&lt;li&gt;Keep this page open. Your gonna need to use the info here shortly.&lt;/li&gt;
&lt;li&gt;Open up Eclipse&lt;/li&gt;
&lt;li&gt;Right Click on the Android Project you made&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Team&lt;/li&gt;
&lt;li&gt;Synchronize with&lt;/li&gt;
&lt;li&gt;Next (1)&lt;/li&gt;
&lt;li&gt;Now the URL is the one shown on the Checkout Tab of your Project Host (after hg clone) (2)&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The username is your Gmail (3)&lt;/li&gt;
&lt;li&gt;The Password is shown when you click on the &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;&lt;u&gt;google.com password&lt;/u&gt;&lt;/span&gt;&lt;/i&gt; link (4 &amp;amp; 5)&lt;/li&gt;
&lt;li&gt;Next until Finish&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWGkRV-muothcVbBF-VSpJEPAXyVF_AFYDMkUd6SqGB037_HgE2GykxsAXCRy8JdG1c1o-0V-BRYF3e-wq7wWrfWl_cAuTsJ008ydi2euU-Jy6hjbYG45VD2hNZB3_5bCXOZrFgpYBQtU/s1600/syncing.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWGkRV-muothcVbBF-VSpJEPAXyVF_AFYDMkUd6SqGB037_HgE2GykxsAXCRy8JdG1c1o-0V-BRYF3e-wq7wWrfWl_cAuTsJ008ydi2euU-Jy6hjbYG45VD2hNZB3_5bCXOZrFgpYBQtU/s400/syncing.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;6. First Commit! (Almost There!)&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Right click your project (1)&lt;/li&gt;
&lt;li&gt;Team (2)&lt;/li&gt;
&lt;li&gt;Commit (3)&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9t4l6M9b6Qlqu5WECy9VJMBm37REYRQzTzA8m5fBzWkT13FqiHhXjle6tznD1z9_DTsU-wNplB8AfAoiAN5XEP1UqCVdrNCcHDE85SaYerlAEtFzLS1isiVUWVr3YxXO4Tqot7HXOFgM/s1600/team+commit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9t4l6M9b6Qlqu5WECy9VJMBm37REYRQzTzA8m5fBzWkT13FqiHhXjle6tznD1z9_DTsU-wNplB8AfAoiAN5XEP1UqCVdrNCcHDE85SaYerlAEtFzLS1isiVUWVr3YxXO4Tqot7HXOFgM/s400/team+commit.png&quot; width=&quot;323&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Check Select All (1)&lt;/li&gt;
&lt;li&gt;Put in &quot;Project Start&quot; for the Commit Message&lt;/li&gt;
&lt;li&gt;Ok&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh58XtjT_1bWWn7HVIBENg3-67_21bkguEt9JMXLdevsjl-Sck3cD3p_OyBkoliE5tiORh3g5h9Cv1GIiwvy6Ndq4Gk31QvB6VlV2mLeur7mW-W7JbhHA4R80YcmtPuvbvVA3BtAKQi2lY/s1600/commit+message.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh58XtjT_1bWWn7HVIBENg3-67_21bkguEt9JMXLdevsjl-Sck3cD3p_OyBkoliE5tiORh3g5h9Cv1GIiwvy6Ndq4Gk31QvB6VlV2mLeur7mW-W7JbhHA4R80YcmtPuvbvVA3BtAKQi2lY/s400/commit+message.png&quot; width=&quot;277&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;7. PUUUUUUUUUUUSH! *Grunts* wait its not that hard!&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Right Click on Project (1)&lt;/li&gt;
&lt;li&gt;Team (2)&lt;/li&gt;
&lt;li&gt;Push (3)&lt;/li&gt;
&lt;li&gt;Finish (4)&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLdjA0mta9cs9QeBd8zqabnXy36VLc-GTWrpk4-2jOyY-pedV_S6Yt3HK-kFRbZuQK-x0FKJYvrUaUXrCgUWMMfIejK_gLd3LzrhV18eeik5q1BH15wexvTH8Lf3Wu9RPZ5SI-t1WVkXw/s1600/push+finish.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLdjA0mta9cs9QeBd8zqabnXy36VLc-GTWrpk4-2jOyY-pedV_S6Yt3HK-kFRbZuQK-x0FKJYvrUaUXrCgUWMMfIejK_gLd3LzrhV18eeik5q1BH15wexvTH8Lf3Wu9RPZ5SI-t1WVkXw/s400/push+finish.png&quot; width=&quot;336&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;8. TA DA!&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Go to your Project Homepage&lt;/li&gt;
&lt;li&gt;Click on source&lt;/li&gt;
&lt;li&gt;Now you can either &lt;u&gt;Browse&lt;/u&gt; through you project files or&lt;/li&gt;
&lt;li&gt;See your &lt;u&gt;Changes&lt;/u&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG7nGYzY9SEEKRhONjCTdIh5kFKNbkM7MDLbMHnC6ApJGJk4n6KwuPLaM630PWxotG2mxsqZBWkK21BqlJMO83GMzkMQDAGHmjWenFrj_sOxFvO3eGT5Y1CttWM79DK_UsOeVUwIhQTK8/s1600/ta+da.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;165&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG7nGYzY9SEEKRhONjCTdIh5kFKNbkM7MDLbMHnC6ApJGJk4n6KwuPLaM630PWxotG2mxsqZBWkK21BqlJMO83GMzkMQDAGHmjWenFrj_sOxFvO3eGT5Y1CttWM79DK_UsOeVUwIhQTK8/s400/ta+da.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;10. Wait a minute!&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;You probably want to know how to have your work show up in other computer that you wanna work on (Which already have Android ,Eclipse ,and the Mercurial Eclipse Plug-in installed already) Easy!&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;(Try this on another computer if you want can to see some magic happen)&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Go to Eclipse&lt;/li&gt;
&lt;li&gt;File (1)&lt;/li&gt;
&lt;li&gt;Import (2)&lt;/li&gt;
&lt;li&gt;Clone Existing Mercurial Repository (Under the Mercurial Tab)&lt;/li&gt;
&lt;li&gt;Next&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_a7E4I0AmGzlQzKAiOR-sU5ecnyXO4LVyrXkqfQOPMSlcae9wPojf8WPCjdkKREeg2qgxeAN_bDG28T6aJda1w6WPBK5dtily7KhzL3uzdPqPOBj7CwIKtPRCBbZdBzV3tzzoZYcryQ4/s1600/import+project.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_a7E4I0AmGzlQzKAiOR-sU5ecnyXO4LVyrXkqfQOPMSlcae9wPojf8WPCjdkKREeg2qgxeAN_bDG28T6aJda1w6WPBK5dtily7KhzL3uzdPqPOBj7CwIKtPRCBbZdBzV3tzzoZYcryQ4/s400/import+project.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Now just put in all the info that you put in when you Synchronized the Local Repository to the Google Project website.&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMKkLY2SDeQZEEImiNBdHExiZEguf4XLxez151z9UP30CayO4RjUwo6UU0p7p0xc4MGMQEN0qXcHv1U7tzmDE7R4WLb3UUyZF9fU0UsnxvBd5FKEkDOGdDPqgv27ooBn6RsxJIr9mkqYs/s1600/clone+repository.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;281&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMKkLY2SDeQZEEImiNBdHExiZEguf4XLxez151z9UP30CayO4RjUwo6UU0p7p0xc4MGMQEN0qXcHv1U7tzmDE7R4WLb3UUyZF9fU0UsnxvBd5FKEkDOGdDPqgv27ooBn6RsxJIr9mkqYs/s400/clone+repository.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Now you can keep your project synced between&amp;nbsp;colleagues, or just between your different workstations. When you wanna save some work just Team -&amp;gt; Commit and when you wanna sync it with the Project Hosting just Team -&amp;gt; Push&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;PS: Write any suggestion in my comments or contact me on twitter:&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;a href=&quot;http://twitter.com/#!/tytdfn&quot; style=&quot;color: #888888; text-decoration: none;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;@tytdfn&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/6811999008011930563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/03/easy-android-app-project-hosting-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/6811999008011930563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/6811999008011930563'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/03/easy-android-app-project-hosting-with.html' title='Easy Android App Project Hosting with Eclipse and Google Code'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MFhmPASvS22aILPmweALD3sfGrsVe353LSN1ad8apdRlAt1h24uRU-yyGt4rq33v8FARYH0WkTP6N0Ry0CLumrPMRTAWUlhu0-UEGVrxMG8iyap5XJTGM_Uo56wdSzDhjy3FyPwku08/s72-c/setting+up+project.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1756956114470319563.post-4683610747430046078</id><published>2011-03-23T14:33:00.001-04:00</published><updated>2011-03-31T15:34:32.553-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Resource Qualifiers"/><title type='text'>Android: &quot;Smart Folders&quot;</title><content type='html'>I love clean code. One of the features android has that makes it easier to write clean code is a feature I nicknamed &quot;Smart Folders&quot;. Take for example this scenario: You would like your application to have different layouts based on the screen orientation. Your first try might look something like this&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;public void onCreate(Bunde icicle)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; super.onCreate(icicle);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; int orientation =&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;getResources().getConfiguration().orientation;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-size: 14px; line-height: 18px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;if (orientation = Configuration.ORIENTATION_PORTRAIT)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;setContentView(R.layout.main_port);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} else&amp;nbsp;if(orientation = Configuration.ORIENTATION_LANDSCAPE)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setContentView(R.layout.main_land);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/blockquote&gt;&lt;br /&gt;
Then you stumble across this post and magically your code turns into this:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;public void onCreate(Bunde icicle)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; super.onCreate(icicle);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;setContentView(R.layout.main);&lt;br /&gt;
}&lt;/blockquote&gt;&lt;br /&gt;
You ask how is this possible? Simple: Android at runtime checks the configuration of the phone and looks in your /res folder for matching&amp;nbsp;&lt;a href=&quot;http://developer.android.com/guide/practices/screens_support.html#qualifiers&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;Resource Directory Qualifiers&lt;/span&gt;&lt;/a&gt;&amp;nbsp;and uses the correct resources accordingly. WHAT THE HECK DOES THAT MEAN? &amp;nbsp; I hear you sayin&#39;?&lt;br /&gt;
&lt;br /&gt;
It means that if Android detects that the phone is in landscape mode it will check the /layout-land directory/folder for the main.xml . If it can&#39;t find a match then it defaults to checking the regular layout folder. Not only does this make your code easier to read but it will also make it more manageable down the road.&lt;br /&gt;
&lt;br /&gt;
For a list of all the qualifiers android offers look&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;&lt;a href=&quot;http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;Here (Scroll down a little to see the table)&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
Some of the qualifiers include&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Language and region: So you can Localize your strings&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Screen size and/or&amp;nbsp;Screen pixel density (dpi)&amp;nbsp;: So your app looks good on any screen&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Keyboard availability: So you can control when to show the soft keyboard&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Primary non-touch navigation method: So you can support trackballs and trackpads!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
TL;DR:&lt;br /&gt;
1. Put main_port.xml in the /layout &amp;nbsp;directory/folder&lt;br /&gt;
2.&amp;nbsp;Put main_land.xml in the /layout-land&amp;nbsp;directory/folder&lt;br /&gt;
3.Rename both xml&#39;s to main.xml&lt;br /&gt;
&lt;br /&gt;
Piece of Cake! Next Post will be a tutorial on how to set up your app project with a new Google Code Project and how to easily sync your code to your project with the Mercurial Eclipse Plug-in. Please Stay tuned and pass this around.&lt;br /&gt;
&lt;br /&gt;
PS: Write any suggestion in my comments or contact me on twitter:&amp;nbsp;&lt;a href=&quot;http://twitter.com/#!/tytdfn&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;@tytdfn&lt;/span&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://jandn00b.blogspot.com/feeds/4683610747430046078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jandn00b.blogspot.com/2011/03/android-smart-folders.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/4683610747430046078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1756956114470319563/posts/default/4683610747430046078'/><link rel='alternate' type='text/html' href='http://jandn00b.blogspot.com/2011/03/android-smart-folders.html' title='Android: &quot;Smart Folders&quot;'/><author><name>Gonzalo Andreani</name><uri>http://www.blogger.com/profile/09825431284013542022</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXhybCWDAmV7V-n7G09N-ReRpq2BaAQRumYvRJmCuUy8QThnP_8Id-hWlL3YjEh0rmh-74fsnWPnwK1ExAEmK4uOioESp6xUi5utnYMRZgGemahJgKg-r2vHd8IRj74w/s220/picture.png'/></author><thr:total>0</thr:total></entry></feed>