<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D0cDQ3w8fyp7ImA9WhRVFEs.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485</id><updated>2012-01-14T01:31:12.277+11:00</updated><category term="images" /><category term="tools" /><category term="making money" /><category term="debugging" /><category term="news" /><category term="books" /><category term="psst" /><category term="map" /><category term="L10n and i10n" /><category term="inspiration" /><category term="My Apps" /><category term="Programming" /><category term="Activity Lifecycle" /><category term="Android Debug Bridge" /><category term="Context" /><category term="installing Apk apps" /><category term="notifications" /><category term="sdk" /><category term="Wino" /><category term="keyboard" /><category term="video" /><category term="layout" /><category term="Honeycomb" /><category term="Google App Inventor" /><category term="localisation" /><category term="Spinner" /><category term="Gallery" /><category term="Adapters" /><category term="ADB" /><category term="xml" /><category term="buttons" /><category term="business" /><category term="recycling" /><category term="sqlite" /><category term="coding tips" /><category term="games" /><category term="internationalisation" /><category term="how-to" /><category term="Screen size" /><category term="shameless self-promotion" /><category term="widgets" /><category term="hints" /><category term="databases" /><category term="Herb and Spice Helper" /><category term="background images" /><category term="Development" /><category term="status bar" /><category term="Wine Advisor" /><category term="tutorials" /><category term="Getting started" /><category term="TextView" /><category term="marketing" /><category term="EditText" /><category term="components" /><category term="toast" /><category term="listView" /><title>android for beginners</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://androidforbeginners.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>48</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/IsoLY" /><feedburner:info uri="blogspot/isoly" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;C08NQX87cSp7ImA9WhRXGEg.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-6005331380523484927</id><published>2011-12-21T15:53:00.000+11:00</published><updated>2011-12-26T09:24:50.109+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-26T09:24:50.109+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>'Tis the season for sharing (via your Android code)</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ogco0hH8XxE/TvFedj-88RI/AAAAAAAAPbg/Y6JdOg9x-UY/s1600/android-christmas.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-ogco0hH8XxE/TvFedj-88RI/AAAAAAAAPbg/Y6JdOg9x-UY/s320/android-christmas.jpg" width="232" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;b&gt;Come Facebook, come Twitter, come Tumblr and Flickr!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
No app is an island, we often want to be able to share the cool things we create with our apps with the world, whether it's the latest social network to on-sell our personal details, or just plain old email to your gran.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-EFZXv3jzfPU/TvFoH3rToTI/AAAAAAAAPb4/AhmXNkW3egM/s1600/Granny+Cigar.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-EFZXv3jzfPU/TvFoH3rToTI/AAAAAAAAPb4/AhmXNkW3egM/s200/Granny+Cigar.jpg" width="166" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
.. And here's how.&lt;br /&gt;
&lt;br /&gt;
Lets say we have an image file located here:&lt;br /&gt;
&lt;code&gt;&lt;span style="color: #38761d;"&gt;&lt;b&gt;String fileLocation = "/mnt/sdcard/SomeMediaFiles/aMediaFile10.jpg"&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
We can share this easily by passing the reference to our file location into the below method:&lt;br /&gt;
&amp;nbsp;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;    &lt;b&gt;&lt;span style="color: #274e13;"&gt;public void shareFile(String newFilePath) {
      {Intent share = new Intent(Intent.ACTION_SEND);
      share.setType("image/jpeg");&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt; &lt;/code&gt;&lt;/pre&gt;
//declare the MIME type of the file. .. What you pass into share.setType determines what apps appears in your Sharing list.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
&lt;span style="color: #38761d;"&gt;&lt;b&gt;      Uri imageUri = Uri.fromFile(new File(newImagePath));
      share.putExtra(Intent.EXTRA_STREAM, imageUri);
   
      startActivity(Intent.createChooser(share, "Share"));
 }
}&lt;/b&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
And this is basically what is the result (actual apps listed will depend on what is installed on your users device):

&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-w_Uv-jI9uZg/TvFji66LkRI/AAAAAAAAPbw/U53vq4oI1BY/s1600/share.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/-w_Uv-jI9uZg/TvFji66LkRI/AAAAAAAAPbw/U53vq4oI1BY/s400/share.png" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
... Easy.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-6005331380523484927?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LMuVx94MAe87Wna0j9miQIEwFnw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LMuVx94MAe87Wna0j9miQIEwFnw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LMuVx94MAe87Wna0j9miQIEwFnw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LMuVx94MAe87Wna0j9miQIEwFnw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/WBsik23jfnM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/6005331380523484927/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/12/tis-season-for-sharing-via-your-android.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6005331380523484927?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6005331380523484927?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/WBsik23jfnM/tis-season-for-sharing-via-your-android.html" title="'Tis the season for sharing (via your Android code)" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-ogco0hH8XxE/TvFedj-88RI/AAAAAAAAPbg/Y6JdOg9x-UY/s72-c/android-christmas.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/12/tis-season-for-sharing-via-your-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4CSXg4eip7ImA9WhRQFkU.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-1309794033128988968</id><published>2011-12-10T23:31:00.001+11:00</published><updated>2011-12-12T21:16:08.632+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-12T21:16:08.632+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="images" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="widgets" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="ADB" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><category scheme="http://www.blogger.com/atom/ns#" term="recycling" /><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><category scheme="http://www.blogger.com/atom/ns#" term="Gallery" /><category scheme="http://www.blogger.com/atom/ns#" term="Android Debug Bridge" /><title>OutOfMemory errors when populating a Gallery</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-_BZBzDa2nd8/TuNUx1SnZfI/AAAAAAAAPRY/2yc7Db51044/s1600/article-1244597-07EE5CC2000005DC-747_468x338.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="231" src="http://1.bp.blogspot.com/-_BZBzDa2nd8/TuNUx1SnZfI/AAAAAAAAPRY/2yc7Db51044/s320/article-1244597-07EE5CC2000005DC-747_468x338.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
I've just spent the last couple of hours wrestling with OutOfMemory errors when populating a Gallery widget with photos, and as fun as it's been, I think I've sorted it out and thought I'd share my solution with you.&lt;br /&gt;
&lt;br /&gt;
For starters, the reason we're getting&amp;nbsp;OutOfMemory errors in the first place is that&amp;nbsp;the heap size on Android devices is limited to something like 16 MB on a G1 and 24 MB on a Nexus one.&lt;br /&gt;
&lt;br /&gt;
As soon as you start to&amp;nbsp;work with media files you quickly start to learn that you need to work to manage your memory usage with Android as a result of this limitation.&lt;br /&gt;
&lt;br /&gt;
I would also like to thank&amp;nbsp;direct to device debugging,&amp;nbsp;I couldn't have done this without utilizing it, I would go as far as saying that it is essential in situations like this.&lt;br /&gt;
&lt;br /&gt;
Here is the full code of one of my imageAdapters,&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;I'm using this to provide the images to my Gallery widget like this:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;galleryTop.setAdapter(new ImageAdapterTop(this));&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Adapter class&amp;nbsp;:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public class ImageAdapterTop extends BaseAdapter {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;int mGalleryItemBackground;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;private Context mContext;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; File[] allTopSlices = Utils.getAllTopSlices(); &amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; String[] fullPathAllTopSlices = new String[allTopSlices.length];&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; Uri[] uriAllTopSlices = new Uri[fullPathAllTopSlices.length];&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;public ImageAdapterTop(Context c) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mContext = c;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TypedArray a = obtainStyledAttributes(R.styleable.HelloGallery);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mGalleryItemBackground = a.getResourceId(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;R.styleable.HelloGallery_android_galleryItemBackground, 0);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a.recycle();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;public int getCount() {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return uriAllTopSlices.length;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;public Object getItem(int position) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return position;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;public long getItemId(int position) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return position;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;public View getView(int position, View convertView, ViewGroup parent) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;int screenHeightPx &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;= Utils.GetScreenHeight(getWindowManager().getDefaultDisplay());&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; for(int i = 0; i &amp;lt; allTopSlices.length; i++){&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; fullPathAllTopSlices[i] = allTopSlices[i].getAbsolutePath();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; for(int j=0; j &amp;lt; fullPathAllTopSlices.length; j++){&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; uriAllTopSlices[j] = Uri.parse(fullPathAllTopSlices[j]);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ImageView i = new ImageView(mContext);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;recycleDrawable(i);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i.setImageBitmap(Utils.readBitmap(uriAllTopSlices[position].toString()));&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i.setLayoutParams(new Gallery.LayoutParams(400, (screenHeightPx-50) /3));&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i.setScaleType(ImageView.ScaleType.FIT_XY); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i.setBackgroundResource(mGalleryItemBackground);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.gc();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return i;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and the referenced &lt;i&gt;recycleDrawable&lt;/i&gt;&amp;nbsp;:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;private void recycleDrawable(ImageView i) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;BitmapDrawable currentBitmapDrawable = (BitmapDrawable)i.getDrawable();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace; white-space: pre;"&gt;&lt;b&gt;  &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;if(currentBitmapDrawable != null){&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;currentBitmapDrawable.getBitmap().recycle();&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.gc();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and &lt;i&gt;readBitmap&lt;/i&gt; methods:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public static Bitmap readBitmap(String selectedImage) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Bitmap bm = null;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;BitmapFactory.Options options = new BitmapFactory.Options();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;options.inSampleSize = 8;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;try {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;bm = BitmapFactory.decodeFile(selectedImage, options);&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;catch (OutOfMemoryError e) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;e.printStackTrace();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace; white-space: pre;"&gt;&lt;b&gt;  &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return bm;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Probably worth mentioning that the '&lt;span class="Apple-style-span" style="color: #0b5394; font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;options.inSampleSize'&lt;/b&gt;&lt;/span&gt;&amp;nbsp;reference, which is downsizing the image is pretty much essential when working with large files with the memory constraints associated with current Android devices.&lt;br /&gt;
&lt;br /&gt;
Hope that helps someone out there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-1309794033128988968?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NxUcBj4P6pAmaq7l9gR7kuiuDbM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NxUcBj4P6pAmaq7l9gR7kuiuDbM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NxUcBj4P6pAmaq7l9gR7kuiuDbM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NxUcBj4P6pAmaq7l9gR7kuiuDbM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/cFhYduyJzxE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/1309794033128988968/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/12/wrestling-with-outofmemory-errors-when.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1309794033128988968?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1309794033128988968?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/cFhYduyJzxE/wrestling-with-outofmemory-errors-when.html" title="OutOfMemory errors when populating a Gallery" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-_BZBzDa2nd8/TuNUx1SnZfI/AAAAAAAAPRY/2yc7Db51044/s72-c/article-1244597-07EE5CC2000005DC-747_468x338.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/12/wrestling-with-outofmemory-errors-when.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YGQX8-fSp7ImA9WhRSGE4.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-6700984214822635325</id><published>2011-11-20T22:45:00.001+11:00</published><updated>2011-11-21T10:18:40.155+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-21T10:18:40.155+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="images" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="recycling" /><title>'An error has occurred' when working with Bitmaps</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-dTNDgBU_P9w/TsjoSOZESpI/AAAAAAAAOzY/L30m62RKp-I/s1600/slicing-tomatoes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-dTNDgBU_P9w/TsjoSOZESpI/AAAAAAAAOzY/L30m62RKp-I/s320/slicing-tomatoes.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
On a recent project I needed to rotate and slice images taken from the camera, and I found that I was getting regular, but annoying to track down 'an error has occurred' messages.&lt;br /&gt;
&lt;br /&gt;
I couldn't see anything in particular that was wrong with my code, and what made it worse was that I wasn't receiving any errors at all in the emulator, only when I deployed the app to my phone for testing.&lt;br /&gt;
&lt;br /&gt;
It took a few hours to figure out what was going on, so I thought I'd share it here and maybe save somebody else some time.&lt;br /&gt;
&lt;br /&gt;
Like a lot of errors, it seemed painfully obvious after the fact, but the cause was I was basically running out of memory when creating the bitmap objects below. From my experience, you can only create one or two bitmap objects before you will encounter issues like this, because the heap size on Android devices is limited to something like 16&amp;nbsp;MB&amp;nbsp;on a G1 and 24&amp;nbsp;MB&amp;nbsp;on a Nexus one.&lt;br /&gt;
.. That's not a lot of 6&amp;nbsp;MB&amp;nbsp;photos.&lt;br /&gt;
&lt;br /&gt;
Luckily, it's super easy to fix.&lt;br /&gt;
All you need to do is recycle the bitmaps once you've finished with them, as per below code, and as pointed out by Romain Guy &lt;a href="http://stackoverflow.com/questions/7010467/android-bitmap-createbitmap-fills-heap" target="_blank"&gt;here&lt;/a&gt;,&lt;br /&gt;
&lt;br /&gt;
"..&lt;quote&gt;The problem is that it can take a couple of GC cycles for a Bitmap to be properly released on Android before Android 3.x. Even if you call recycle() I believe the bitmap counts against your heap usage until at least the next GC. This is one of the very few situations where I would advise you to force a GC by calling System.gc()."&lt;/quote&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;Matrix mat = new Matrix();&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;mat.postRotate(90);&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
Bitmap photoRotated = Bitmap.createBitmap(bitmapToSave, 0, 0, bitmapToSave.getWidth(), bitmapToSave.getHeight(), mat, false);&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"&gt;&lt;pre class="source-code"&gt;&lt;code&gt;Bitmap photoCut1 = Bitmap.createBitmap(photoRotated, 0, 0, photoRotated.getWidth(), heightOfSlice);&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"&gt;&lt;pre class="source-code"&gt;&lt;b&gt;&lt;code&gt;photoRotated.&lt;/code&gt;recycle();&lt;/b&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;//save photoCut1 bitmap here&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;code&gt;&lt;b&gt;photoCut1.recycle();
System.gc();&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
So don't forget to recycle&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;and call System.gc() a couple of times when working with large files like images and hopefully, like me, your errors messages will disappear.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-6700984214822635325?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1cu39tt48BFR57al2dfBQKRiOCE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1cu39tt48BFR57al2dfBQKRiOCE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1cu39tt48BFR57al2dfBQKRiOCE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1cu39tt48BFR57al2dfBQKRiOCE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/xahA1SKVnh4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/6700984214822635325/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/11/error-has-occurred-when-working-with.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6700984214822635325?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6700984214822635325?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/xahA1SKVnh4/error-has-occurred-when-working-with.html" title="'An error has occurred' when working with Bitmaps" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-dTNDgBU_P9w/TsjoSOZESpI/AAAAAAAAOzY/L30m62RKp-I/s72-c/slicing-tomatoes.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/11/error-has-occurred-when-working-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIFSXsyeyp7ImA9WhZUGU4.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-4794213912057569200</id><published>2011-06-13T12:35:00.000+10:00</published><updated>2011-06-13T12:35:18.593+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-13T12:35:18.593+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><category scheme="http://www.blogger.com/atom/ns#" term="Screen size" /><title>How to get the size and orientation of your device screen</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-bBKNHzfRZ6o/TfV2nN34ESI/AAAAAAAALxc/8csBxgLmE3M/s1600/screen-sizes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="232" src="http://1.bp.blogspot.com/-bBKNHzfRZ6o/TfV2nN34ESI/AAAAAAAALxc/8csBxgLmE3M/s320/screen-sizes.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Found this great snippet over at &lt;a href="http://www.androidsnippets.com/"&gt;http://www.androidsnippets.com/&lt;/a&gt;&amp;nbsp;that allows you to find the size and orientation of the device screen at runtime, and thought I'd share it:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;/* First, get the Display from the WindowManager */
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();

/* Now we can retrieve all display-related infos */
int width = display.getWidth();
int height = display.getHeight();
int orientation = display.getOrientation();
// see http://androidsnippets.com/get-size-and-orientation-of-the-screen
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-4794213912057569200?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wiDB7Ms4bWn_evN6F-p937A-gtw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wiDB7Ms4bWn_evN6F-p937A-gtw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wiDB7Ms4bWn_evN6F-p937A-gtw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wiDB7Ms4bWn_evN6F-p937A-gtw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/XxnB1XckeTE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/4794213912057569200/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/06/how-to-get-size-and-orientation-of-your.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4794213912057569200?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4794213912057569200?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/XxnB1XckeTE/how-to-get-size-and-orientation-of-your.html" title="How to get the size and orientation of your device screen" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-bBKNHzfRZ6o/TfV2nN34ESI/AAAAAAAALxc/8csBxgLmE3M/s72-c/screen-sizes.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/06/how-to-get-size-and-orientation-of-your.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4BQnY4eyp7ImA9WhRQFkU.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-5371099403111185627</id><published>2011-05-28T10:33:00.001+10:00</published><updated>2011-12-12T21:15:53.833+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-12T21:15:53.833+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="marketing" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><category scheme="http://www.blogger.com/atom/ns#" term="making money" /><category scheme="http://www.blogger.com/atom/ns#" term="business" /><title>How do you make money with your Android app?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-aWT7XrMx3Pw/TuRSTZGZEVI/AAAAAAAAPSQ/NZDezoK806A/s1600/android_logo-dollars.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-aWT7XrMx3Pw/TuRSTZGZEVI/AAAAAAAAPSQ/NZDezoK806A/s320/android_logo-dollars.jpg" width="273" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Free?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Obviously not the best way to make money, but a good way to get your name out there, and earn some good karma points while you're at it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Advantages: &lt;/b&gt;maximum exposure to users, everyone who might possible have a use for it considers a free app and will probably install your app even temporarily. You get an opportunity to impress them and build a trusted name with them. The Android Market also lists other apps by the same developer, so viewers of your free apps on the market will be exposed to anything else you publish, driving traffic towards any other apps you might have.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Disadvantages: &lt;/b&gt;Without charging for the app itself, you have to use advertising or in-app purchases or other tie-ins in order to make money (see next).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Free with Ads?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Advantages: &lt;/b&gt;Ad providers such as admob support house ads, which is advertising for your own products. This opens another opportunity to use your free apps to drive traffic towards any paid apps you might have, or other free offerings too.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Disadvantages:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Advertising sdk's usually add an additional weight to your app size, and there's the obvious loss of screen real-estate&amp;nbsp;also. Additionally, people have to actually use your app in order to see and hopefully click on the ads, so unless your app involves a decent amount of user interaction this might not be for you. To make the most of advertising you want to have an app that keeps users coming back to the screen. Something like a countdown timer for instance might not be so suitable for an advertising-based revenue model as the concept involves minimum user face time, users typically set the timer and turn off the screen.&lt;br /&gt;
&lt;br /&gt;
Advertising platforms:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;a href="https://www.admob.com/"&gt;https://www.admob.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.smaato.com/"&gt;http://www.smaato.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.tooyoou.com/"&gt;http://www.tooyoou.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://adiquity.com/"&gt;http://adiquity.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Free with&amp;nbsp;in-app purchases?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style="font-weight: bold;"&gt;Advantages: &lt;/b&gt;You get users in the door and using your app, now you can ply them with the ability to purchase additional related goods in-app.&amp;nbsp;Micro-payment&amp;nbsp;systems mean that your users have the option of adding custom content for mere cents, all within the bounds of your free app, and an app that might not generate much interest even at the lowest price point (usually 99c), is able to still generate income. You get the user mass by distributing your core app for free, and then can utilise novelty-driven or premium-functionality requirements towards generating income. Can also be combined with Advertising, but be mindful of how this can adversely affect user perception of your app.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="font-weight: bold;"&gt;Disadvantages: &lt;/b&gt;more complex to implement that advertising, and obviously requires actual additional content which not all apps are suited to. Micropayment systems not available in all countries.&lt;br /&gt;
&lt;br /&gt;
In-app billing/virtual goods/virtual currencies:&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;a href="http://developer.android.com/guide/market/billing/index.html"&gt;http://developer.android.com/guide/market/billing/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.tapjoy.com/site/app_developers"&gt;https://www.tapjoy.com/site/app_developers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Free cut-down or trial version and paid 'pro' version?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Advantages: &lt;/b&gt;Similar to in-app purchases and other 'freemium' techniques, you introduce the users to the concept of your app in the free version, then hope that some of these users are willing to pay for additional content once your free version has earned their respect.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Disadvantages: &lt;/b&gt;Unlike in-app purchases and the&amp;nbsp;micro-payment&amp;nbsp;model, the paid 'pro' version is restricted by the minimum price point of the market through which you're distributing your app which in the case of the Android Market is 99c. If you don't have the additional content to warrant meeting that initial price threshold, you're flat out of luck.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Paid?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style="font-weight: bold;"&gt;Advantages: &lt;/b&gt;You make profit upfront, regardless of how much someone uses your app, and regardless of even if they keep it installed. Once they've past that initial 15 minutes to refund, you profit.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="font-weight: bold;"&gt;Disadvantages: &lt;/b&gt;Android users are a notoriously stingy bunch, although as more Android users could be considered the mainstream demographic rather than the tech-head early adopters, this may change. Piracy can also be an issue, so make use of the licensing validation library provided by Google. Paid apps also run the risk of being undersold by a competing free product that relies on one of the other methods above to generate income. Also, as strange as it might seem, many users balk when confronted with the option of paying 99c for an app for their $500 device.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-5371099403111185627?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9dvZieyszCvc_QeRrD2pJefqpzQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9dvZieyszCvc_QeRrD2pJefqpzQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9dvZieyszCvc_QeRrD2pJefqpzQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9dvZieyszCvc_QeRrD2pJefqpzQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/PDcjzL6lBg4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/5371099403111185627/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/05/how-do-you-make-money-with-your-android.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/5371099403111185627?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/5371099403111185627?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/PDcjzL6lBg4/how-do-you-make-money-with-your-android.html" title="How do you make money with your Android app?" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-aWT7XrMx3Pw/TuRSTZGZEVI/AAAAAAAAPSQ/NZDezoK806A/s72-c/android_logo-dollars.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/05/how-do-you-make-money-with-your-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MNRnc-eyp7ImA9WhZTGEo.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-4354993880589488993</id><published>2011-03-23T22:24:00.000+11:00</published><updated>2011-03-23T22:24:57.953+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-23T22:24:57.953+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="layout" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>Creating a simple border with rounded corners for a layout or view</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-r4sJkHHdOcM/TYnX4XgPxjI/AAAAAAAALZ4/_FxcGFYk44Y/s1600/border_patrol.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="293" src="https://lh6.googleusercontent.com/-r4sJkHHdOcM/TYnX4XgPxjI/AAAAAAAALZ4/_FxcGFYk44Y/s400/border_patrol.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;not the border in question..&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
Hi all, just thought I'd post this simple snippet that I've just found.&lt;br /&gt;
This allows you to simply add a border ( even with rounded corners!) to a layout or view.&lt;br /&gt;
&lt;br /&gt;
All you need to do is create a new xml file somewhere in /res/drawable called 'the_border.xml'&lt;br /&gt;
with this or similar as the contents:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&amp;lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt; 
    &amp;lt;stroke android:width="1dp" android:color="#FFFFFF" /&amp;gt; 
    &amp;lt;padding android:left="7dp" android:top="13dp" 
            android:right="7dp" android:bottom="17dp" /&amp;gt; 
    &amp;lt;corners android:radius="4dp" /&amp;gt; 
&amp;lt;/shape&amp;gt; &lt;/span&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
You can then reference this as the background of an item in your layout like this (in xml)&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;android:background="@drawable/the_border"&lt;/span&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;or like this in code:&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;llErrorMessage.setBackgroundResource(R.drawable.the_border);&lt;/span&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Nice eh?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-4354993880589488993?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OnnQdFmUStM3w_Zc9-icTIdWnAo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OnnQdFmUStM3w_Zc9-icTIdWnAo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OnnQdFmUStM3w_Zc9-icTIdWnAo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OnnQdFmUStM3w_Zc9-icTIdWnAo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/v6yXhgIRA-M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/4354993880589488993/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/03/creating-simple-border-with-rounded.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4354993880589488993?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4354993880589488993?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/v6yXhgIRA-M/creating-simple-border-with-rounded.html" title="Creating a simple border with rounded corners for a layout or view" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh6.googleusercontent.com/-r4sJkHHdOcM/TYnX4XgPxjI/AAAAAAAALZ4/_FxcGFYk44Y/s72-c/border_patrol.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/03/creating-simple-border-with-rounded.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08MQHY9eyp7ImA9WhZTEko.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-8626966590464064919</id><published>2011-03-16T20:27:00.003+11:00</published><updated>2011-03-16T21:38:01.863+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-16T21:38:01.863+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="shameless self-promotion" /><category scheme="http://www.blogger.com/atom/ns#" term="Herb and Spice Helper" /><category scheme="http://www.blogger.com/atom/ns#" term="My Apps" /><title>My new Android app, 'Herbert the Herb &amp; Spice Helper' now available on the Android Market</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-FCS-a9JFXxo/TYCBjuPP2mI/AAAAAAAALUs/fO_SsbBMEqI/s1600/logo2_512.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="https://lh6.googleusercontent.com/-FCS-a9JFXxo/TYCBjuPP2mI/AAAAAAAALUs/fO_SsbBMEqI/s200/logo2_512.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px;"&gt;My new Android app, '&lt;a href="https://market.android.com/details?id=com.BlueMongo.HerbHelper"&gt;Herbert the Herb &amp;amp; Spice Helper&lt;/a&gt;' is now available on the Android Market.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;Here's the blurb: "With over 70 herbs and spices, 50+ ingredients and 19 different meal styles, you'll never be lost in your kitchen again.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;Herbert the Herb &amp;amp; Spice Helper allows you to mix and match ingredients and meal styles to see what combinations are best.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;Each herb and spice comes with a list of compatible herb and spices, and also what you can use instead, so you don't have to run to the supermarket at the last moment."&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;Oh what? You want screenshots?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;Ok, here you go:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-Y7Eng3e5fBk/TYCCBk1KyXI/AAAAAAAALUw/sIwf4Cxzs60/s1600/HHselection2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="https://lh5.googleusercontent.com/-Y7Eng3e5fBk/TYCCBk1KyXI/AAAAAAAALUw/sIwf4Cxzs60/s320/HHselection2.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-Wvgdd4nRfXA/TYCCD_N7l3I/AAAAAAAALU0/LdGwkMqLQ10/s1600/basilTop.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="https://lh3.googleusercontent.com/-Wvgdd4nRfXA/TYCCD_N7l3I/AAAAAAAALU0/LdGwkMqLQ10/s320/basilTop.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-kjv-2KERRlM/TYCCEi52mZI/AAAAAAAALU4/yDmmS93wrAs/s1600/basilMid.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="https://lh5.googleusercontent.com/-kjv-2KERRlM/TYCCEi52mZI/AAAAAAAALU4/yDmmS93wrAs/s320/basilMid.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-reb-NwyzwdM/TYCCFQSCHcI/AAAAAAAALU8/F16MdelBt-w/s1600/basilBottom.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="https://lh4.googleusercontent.com/-reb-NwyzwdM/TYCCFQSCHcI/AAAAAAAALU8/F16MdelBt-w/s320/basilBottom.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px; line-height: 19px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;A veritable &lt;i&gt;bargain&lt;/i&gt; at only 99c AU&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px;"&gt;Get it &lt;b&gt;&lt;a href="https://market.android.com/details?id=com.BlueMongo.HerbHelper"&gt;here&lt;/a&gt;&lt;/b&gt;. &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-8626966590464064919?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/M5iz8mY3VSm2eeNuCVh2EDpHB-o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/M5iz8mY3VSm2eeNuCVh2EDpHB-o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/M5iz8mY3VSm2eeNuCVh2EDpHB-o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/M5iz8mY3VSm2eeNuCVh2EDpHB-o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/EvXvdEsdc44" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/8626966590464064919/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/03/herbert-herb-spice-helper-now-available.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/8626966590464064919?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/8626966590464064919?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/EvXvdEsdc44/herbert-herb-spice-helper-now-available.html" title="My new Android app, 'Herbert the Herb &amp; Spice Helper' now available on the Android Market" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh6.googleusercontent.com/-FCS-a9JFXxo/TYCBjuPP2mI/AAAAAAAALUs/fO_SsbBMEqI/s72-c/logo2_512.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/03/herbert-herb-spice-helper-now-available.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEAR3g4eSp7ImA9Wx9bFEs.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-987040052937523999</id><published>2011-02-23T22:27:00.001+11:00</published><updated>2011-02-23T22:30:46.631+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-23T22:30:46.631+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Honeycomb" /><category scheme="http://www.blogger.com/atom/ns#" term="news" /><category scheme="http://www.blogger.com/atom/ns#" term="sdk" /><title>Android 3.0 ‘Honeycomb’ SDK now available</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-dx8U8THZsUU/TWTr1VSfnzI/AAAAAAAALP0/DgSOoOLaWlo/s1600/honeycomb-bee.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/-dx8U8THZsUU/TWTr1VSfnzI/AAAAAAAALP0/DgSOoOLaWlo/s400/honeycomb-bee.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Google’s Android developer team has announced the first &lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Android 3.0&lt;/b&gt;&lt;/span&gt; (&lt;b&gt;API Level: 11)&lt;/b&gt;&amp;nbsp;software developer kit is &lt;a href="http://developer.android.com/sdk/android-3.0.html"&gt;available&lt;/a&gt; to developers to create apps and widgets for tablet devices.&lt;br /&gt;
&lt;br /&gt;
Android 3.0 is a new version of the Android platform that is specifically optimised for devices with larger screen sizes, particularly tablets. It introduces a brand new 'holographic' UI design, as well as an elegant, content-focused interaction model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;New features include: &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
·         UI Builder improvements in the ADT Plugin, including a &lt;a href="http://tools.android.com/recent/newpalette"&gt;new Palette tool&lt;/a&gt; with categories and rendering previews, more accurate rendering of layouts to more faithfully reflect how the layout will look on devices, including rendering status and title bars to more accurately reflect screen space actually available to applications.&lt;br /&gt;
&lt;br /&gt;
Selection-sensitive action bars to manipulate View properties.&lt;br /&gt;
&lt;br /&gt;
Zoom improvements (fit to view, persistent scale, keyboard access)&lt;br /&gt;
&lt;br /&gt;
Improved support for layouts, as well as layouts with gesture overlays.&lt;br /&gt;
&lt;br /&gt;
Traceview integration for easier profiling from ADT.&lt;br /&gt;
&lt;br /&gt;
Tools for using the Renderscript graphics engine: the SDK tools now compiles .rs files into Java Programming Language files and native bytecode.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Fragments&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A fragment is a new framework component that allows you to separate distinct elements of an activity into self-contained modules that define their own UI and lifecycle. To create a fragment, you must extend the Fragment class and implement several lifecycle callback methods, similar to an Activity. You can then combine multiple fragments in a single activity to build a multi-pane UI in which each pane manages its own lifecycle and user inputs.&lt;br /&gt;
&lt;br /&gt;
You can also use a fragment without providing a UI and instead use the fragment as a worker for the activity, such as to manage the progress of a download that occurs only while the activity is running.&lt;br /&gt;
&lt;br /&gt;
Fragments are self-contained and you can reuse them in multiple activities.&lt;br /&gt;
&lt;br /&gt;
You can add, remove, replace and animate fragments inside the activity&lt;br /&gt;
You can add fragments to a back stack managed by the activity, preserving the state of fragments as they are changed and allowing the user to navigate backward through the different states&lt;br /&gt;
By providing alternative layouts, you can mix and match fragments, based on the screen size and orientation&lt;br /&gt;
Fragments have direct access to their container activity and can contribute items to the activity's Action Bar.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;New animation framework&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The platform includes a flexible new animation framework that lets developers easily animate the properties of UI elements such as Views, Widgets, Fragments, Drawables, or any arbitrary object. Animations can create fades or movement between states, loop an animated image or an existing animation, change colors, and much more. Adding animation to UI elements can add visual interest to an application and refine the user experience, to keep users engaged.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Hardware-accelerated 2D graphics&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Android 3.0 offers a new hardware-accelerated OpenGL renderer that gives a performance boost to many common graphics operations for applications running in the Android framework. When the renderer is enabled, most operations in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated. Developers can control how hardware-acceleration is applied at every level, from enabling it globally in an application to enabling it in specific Activities and Views inside the application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Renderscript 3D graphics engine&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Renderscript is a runtime 3D framework that provides both an API for building 3D scenes as well as a special, platform-independent shader language for maximum performance. Using Renderscript, you can accelerate graphics operations and data processing. Renderscript is an ideal way to create high-performance 3D effects for applications, wallpapers, carousels, and more.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Support for multicore processor architectures&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Android 3.0 is the first version of the platform designed to run on either single or multicore processor architectures. A variety of changes in the Dalvik VM, Bionic library, and elsewhere add support for symmetric multiprocessing in multicore environments. These optimizations can benefit all applications, even those that are single-threaded. For example, with two active cores, a single-threaded application might still see a performance boost if the Dalvik garbage collector runs on the second core. The system will arrange for this automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;System clipboard&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Applications can now copy and paste data (beyond mere text) to and from the system-wide clipboard. Clipped data can be plain text, a URI, or an intent.&lt;br /&gt;
&lt;br /&gt;
By providing the system access to the data you want the user to copy, through a content provider, the user can copy complex content (such as an image or data structure) from your application and paste it into another application that supports that type of content.&lt;br /&gt;
&lt;br /&gt;
.. and more!&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-987040052937523999?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/s98Lkwla_rkyMF5EDdnyLUNaHKU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/s98Lkwla_rkyMF5EDdnyLUNaHKU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/s98Lkwla_rkyMF5EDdnyLUNaHKU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/s98Lkwla_rkyMF5EDdnyLUNaHKU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/MZVel8LuRj8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/987040052937523999/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/02/android-30-honeycomb-sdk-now-available.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/987040052937523999?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/987040052937523999?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/MZVel8LuRj8/android-30-honeycomb-sdk-now-available.html" title="Android 3.0 ‘Honeycomb’ SDK now available" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-dx8U8THZsUU/TWTr1VSfnzI/AAAAAAAALP0/DgSOoOLaWlo/s72-c/honeycomb-bee.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/02/android-30-honeycomb-sdk-now-available.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08GRn0yfip7ImA9Wx9UFUs.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-2064375247798005924</id><published>2011-02-13T13:56:00.001+11:00</published><updated>2011-02-13T13:57:07.396+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-13T13:57:07.396+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="TextView" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><category scheme="http://www.blogger.com/atom/ns#" term="xml" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>TextView background is black when setting colour from xml?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
I had a colour defined in a 'colours.xml' file in my project's 'values' folder like so:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;resources&amp;gt;
    &amp;lt;color name="tvBackground"&amp;gt;#337700&amp;lt;/color&amp;gt;
&amp;lt;/resources&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;Which, for those of you who cannot transpose directly from hex, looks like this:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-1AIbqT8kEEQ/TVdEMkJMnCI/AAAAAAAALNg/ym3Z0vMzk1E/s1600/greensqr.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-1AIbqT8kEEQ/TVdEMkJMnCI/AAAAAAAALNg/ym3Z0vMzk1E/s200/greensqr.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
My code looked like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;   TextView tv = new TextView(getApplicationContext());
       
   tv.setBackgroundColor(R.color.tvBackground);&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;Seems reasonable doesn't it?&lt;br /&gt;
&lt;br /&gt;
But when I ran my code, my shiny new little TextView came out with the background colour of this:&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HsSWEh5G4bQ/TVdEOfJbUpI/AAAAAAAALNk/Qj1Rekj1VMM/s1600/black-square.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-HsSWEh5G4bQ/TVdEOfJbUpI/AAAAAAAALNk/Qj1Rekj1VMM/s200/black-square.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;(that's #000000 in hex, or 'black' btw)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
What was going on here?&lt;br /&gt;
Turns out, I wasn't using the correct method to set the background colour so that it comes out correctly, what I should have used was either of these:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;   &lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;tv.setBackgroundResource(R.color.tvBackground);&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="text-align: center;"&gt;- or -&lt;/div&gt;&lt;pre class="source-code"&gt;&lt;code&gt;   &lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;tv.setBackgroundColor(getResources().getColor(R.color.tvBackground));&lt;/span&gt;&lt;/b&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
.. Not especially well documented, but easily fixed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Anyhow, now my TextView shows with the background colour of:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-1AIbqT8kEEQ/TVdEMkJMnCI/AAAAAAAALNg/ym3Z0vMzk1E/s1600/greensqr.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-1AIbqT8kEEQ/TVdEMkJMnCI/AAAAAAAALNg/ym3Z0vMzk1E/s200/greensqr.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
.. So all is now well with the world. Thought I'd just post this in case it helps someone out there (or myself when I forget next time)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
until that next time, bye bye.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-2064375247798005924?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R_lzwkz4aVRC-KuaOXs8zpuZZrA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R_lzwkz4aVRC-KuaOXs8zpuZZrA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R_lzwkz4aVRC-KuaOXs8zpuZZrA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R_lzwkz4aVRC-KuaOXs8zpuZZrA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/LaIPjnYj4Hk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/2064375247798005924/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/02/textview-back-is-black-when-setting.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/2064375247798005924?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/2064375247798005924?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/LaIPjnYj4Hk/textview-back-is-black-when-setting.html" title="TextView background is black when setting colour from xml?" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-1AIbqT8kEEQ/TVdEMkJMnCI/AAAAAAAALNg/ym3Z0vMzk1E/s72-c/greensqr.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/02/textview-back-is-black-when-setting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAGSXs6eyp7ImA9WhZTEks.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-7166292295944205477</id><published>2011-02-07T20:39:00.000+11:00</published><updated>2011-03-16T20:28:48.513+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-16T20:28:48.513+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="shameless self-promotion" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="images" /><category scheme="http://www.blogger.com/atom/ns#" term="Wine Advisor" /><category scheme="http://www.blogger.com/atom/ns#" term="My Apps" /><category scheme="http://www.blogger.com/atom/ns#" term="Wino" /><title>Wino the Wine Advisor now updated, new features &amp; grrraphics</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TMOlrIzyCkI/AAAAAAAAKc4/ARKyLtSLbts/s1600/wino2_500px.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TMOlrIzyCkI/AAAAAAAAKc4/ARKyLtSLbts/s320/wino2_500px.png" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I've recently released an update for my &lt;a href="https://market.android.com/details?id=blueMongo.WineAdvisor"&gt;Wino the Wine Advisor&lt;/a&gt; app,&lt;br /&gt;
The new version now allows you to combine tastes and also has some great new wine bottle graphics (even if I do say so myself).&lt;br /&gt;
&lt;br /&gt;
Here are some screenshots:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TU-8Y4aZphI/AAAAAAAALJ4/xUkovYKecm4/s1600/Screenshot-9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TU-8Y4aZphI/AAAAAAAALJ4/xUkovYKecm4/s320/Screenshot-9.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_Q-JSg53A3nM/TU-8Nr3KFoI/AAAAAAAALJs/MHsYr9vtkDg/s1600/Screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/_Q-JSg53A3nM/TU-8Nr3KFoI/AAAAAAAALJs/MHsYr9vtkDg/s320/Screenshot.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TU-8QGp6E9I/AAAAAAAALJw/X1W5En-j1LA/s1600/Screenshot-8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TU-8QGp6E9I/AAAAAAAALJw/X1W5En-j1LA/s320/Screenshot-8.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;.. And I have to say, those wine bottle images were an absolute &lt;i&gt;pain&lt;/i&gt; to create.&lt;br /&gt;
&lt;br /&gt;
I use Gimp and Inkscape to create all my graphics, in case you were wondering.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-7166292295944205477?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/B3o-FOTKdYaaCp2jMAdLilQmfm0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B3o-FOTKdYaaCp2jMAdLilQmfm0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/B3o-FOTKdYaaCp2jMAdLilQmfm0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B3o-FOTKdYaaCp2jMAdLilQmfm0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/TxokIQr9fL4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/7166292295944205477/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/02/wino-wine-advisor-now-updated-new.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/7166292295944205477?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/7166292295944205477?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/TxokIQr9fL4/wino-wine-advisor-now-updated-new.html" title="Wino the Wine Advisor now updated, new features &amp; grrraphics" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Q-JSg53A3nM/TMOlrIzyCkI/AAAAAAAAKc4/ARKyLtSLbts/s72-c/wino2_500px.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/02/wino-wine-advisor-now-updated-new.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQDRHozeyp7ImA9Wx9WF0k.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-3994399758433615732</id><published>2011-01-23T11:42:00.000+11:00</published><updated>2011-01-23T11:42:55.483+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-23T11:42:55.483+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="psst" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="images" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="layout" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>How to get images dynamically</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_Q-JSg53A3nM/TTt5LmgMeGI/AAAAAAAALC0/M4rTbEe6Ka8/s1600/Commutated_Dynamo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_Q-JSg53A3nM/TTt5LmgMeGI/AAAAAAAALC0/M4rTbEe6Ka8/s1600/Commutated_Dynamo.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Lets say you're storing items in a slqite db for your new, soon-to-be-award-winning application, and one of the columns you're storing is the name of the image to associate with that item.&lt;br /&gt;
&lt;br /&gt;
How on earth do you reference it from within your app so you can display it?&lt;br /&gt;
Good question! Here's how:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//first get a reference to the ImageView in our XML layout file we want to display the image in..&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;ImageView imgVw = (ImageView) customView.findViewById(R.id.imgVwInXML);&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
//Next check that there is actually an image file name in the db column:&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;if (OurDBCursor.getString(OurDBCursor.getColumnIndex("imageName")) != null) 
{&lt;/span&gt;&lt;/b&gt;
 &lt;/code&gt;&lt;/pre&gt;//if there is a name for the image, get that name..&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;  myImageName  = OurDBCursor.getString(OurDBCursor.getColumnIndex("imageName")); &lt;/span&gt;&lt;/b&gt; 
 &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
//get a reference to the image (located in our drawable folder in our project): &lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;          
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;  int resID = getResources().getIdentifier("com.BlueMongo.Test:drawable/" + myImageName, null, null);&lt;/span&gt;&lt;/b&gt;  
 &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
//assign the resouce with that ID to our ImageView:  &lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;               
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #3d85c6;"&gt;  imgVw.setImageResource(resID);
}&lt;/span&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
.. And that's it.&lt;br /&gt;
&lt;br /&gt;
Hope that helps. Have a great day.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-3994399758433615732?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/L2bw0vBSbpPrRfI9XqGaVyMGzts/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L2bw0vBSbpPrRfI9XqGaVyMGzts/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/L2bw0vBSbpPrRfI9XqGaVyMGzts/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L2bw0vBSbpPrRfI9XqGaVyMGzts/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/Eb0eoprAltk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/3994399758433615732/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2011/01/how-to-get-images-dynamically.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/3994399758433615732?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/3994399758433615732?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/Eb0eoprAltk/how-to-get-images-dynamically.html" title="How to get images dynamically" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_Q-JSg53A3nM/TTt5LmgMeGI/AAAAAAAALC0/M4rTbEe6Ka8/s72-c/Commutated_Dynamo.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2011/01/how-to-get-images-dynamically.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EGQ386cCp7ImA9Wx9TEkQ.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-1576919675864429566</id><published>2010-11-21T11:30:00.002+11:00</published><updated>2010-11-21T11:33:42.118+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-21T11:33:42.118+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="L10n and i10n" /><category scheme="http://www.blogger.com/atom/ns#" term="internationalisation" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>Finding the users language settings via code</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/_Q-JSg53A3nM/TOYX2xhfWcI/AAAAAAAAKw4/sKkxtQy1nDA/s320/photo_aboutscola.jpg" width="320" /&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://androidforbeginners.blogspot.com/2010/06/localisation-internationalisation-on.html"&gt;We've seen before&lt;/a&gt; how easy it is to reference difference resources based on the users language settings, but that was more-or-less managed by the Android framework itself.&lt;br /&gt;
&lt;br /&gt;
What if you want to &lt;i&gt;programmatically &lt;/i&gt;make decisions in your code based on what&amp;nbsp;the user's language and local settings are?&lt;br /&gt;
&lt;br /&gt;
Turns out, it's very easy, and here's how:&lt;br /&gt;
(this example assumes you have a TextView in your layout.main called tvLocale)&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;package com.Bluemongo.LanguageTest;

import java.util.Locale;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class LanguageTest extends Activity&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;{
 @Override
 public void onCreate(Bundle savedInstanceState)&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt; {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
        
  TextView tvLocale = (TextView) findViewById(R.id.tvLocale);
        
       if (Locale.getDefault().getLanguage().equals("en")) 
        {tvLocale.setText("you're speaking English");}

        if (Locale.getDefault().getLanguage().equals("de")) 
        {tvLocale.setText("you're speaking German");}
        
        if (Locale.getDefault().getLanguage().equals("fr")) 
        { tvLocale.setText("you're speaking French");}   
        
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
.. Told you it was easy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-1576919675864429566?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ly_G-gmK46aGmlFgcV_NkSITuTE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ly_G-gmK46aGmlFgcV_NkSITuTE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ly_G-gmK46aGmlFgcV_NkSITuTE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ly_G-gmK46aGmlFgcV_NkSITuTE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/YVcdDttXtgM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/1576919675864429566/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/11/finding-users-language-settings-via.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1576919675864429566?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1576919675864429566?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/YVcdDttXtgM/finding-users-language-settings-via.html" title="Finding the users language settings via code" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_Q-JSg53A3nM/TOYX2xhfWcI/AAAAAAAAKw4/sKkxtQy1nDA/s72-c/photo_aboutscola.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/11/finding-users-language-settings-via.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAGSXs6fCp7ImA9WhZTEks.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-4940578819840266234</id><published>2010-10-24T14:29:00.010+11:00</published><updated>2011-03-16T20:28:48.514+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-16T20:28:48.514+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="shameless self-promotion" /><category scheme="http://www.blogger.com/atom/ns#" term="Wine Advisor" /><category scheme="http://www.blogger.com/atom/ns#" term="marketing" /><category scheme="http://www.blogger.com/atom/ns#" term="My Apps" /><category scheme="http://www.blogger.com/atom/ns#" term="Wino" /><title>Wine Advisor, my first paid app is now available on the Android Market.</title><content type="html">&lt;b&gt;&lt;a href="http://www.androidzoom.com/android_applications/lifestyle/wine-advisor_mjzu.html"&gt;Wine Advisor&lt;/a&gt;&lt;/b&gt;, my first paid app is now available on the Android Market.  And it's only $1.99! &lt;i&gt;&lt;b&gt;Bargain!&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TMOlrIzyCkI/AAAAAAAAKc4/ARKyLtSLbts/s1600/wino2_500px.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TMOlrIzyCkI/AAAAAAAAKc4/ARKyLtSLbts/s320/wino2_500px.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Discover what wines go with your favourite foods with Wine Advisor, the premier wine &amp;amp; food pairing assistant on Android.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Choose your food and find wine pairing suggestions, including a brief description of the wine.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Great in restaurants or the grocery store.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;10,000 possible combinations!&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Screenshots:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TMOlN9JHa7I/AAAAAAAAKcw/ZGIcWxMZI6s/s1600/Screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TMOlN9JHa7I/AAAAAAAAKcw/ZGIcWxMZI6s/s320/Screenshot.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy36FUq8UI/AAAAAAAAKfM/y8xVGYocgfY/s1600/Screenshot-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy36FUq8UI/AAAAAAAAKfM/y8xVGYocgfY/s320/Screenshot-4.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy4DRe7RVI/AAAAAAAAKfQ/_jTkzOr6XA4/s1600/Screenshot-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy4DRe7RVI/AAAAAAAAKfQ/_jTkzOr6XA4/s320/Screenshot-3.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy4J--LBJI/AAAAAAAAKfU/eG52V-CXz90/s1600/Screenshot-5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy4J--LBJI/AAAAAAAAKfU/eG52V-CXz90/s320/Screenshot-5.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy4LWBsqiI/AAAAAAAAKfY/3fPGV7nR24Y/s1600/Screenshot-6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TMy4LWBsqiI/AAAAAAAAKfY/3fPGV7nR24Y/s320/Screenshot-6.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TMy4M4X7_LI/AAAAAAAAKfc/1hIezs9eYGs/s1600/Screenshot-7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TMy4M4X7_LI/AAAAAAAAKfc/1hIezs9eYGs/s320/Screenshot-7.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
If you can, please support this blog and consider buying it, I'll be your best friend and answer all your Android questions first &amp;nbsp;:)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-4940578819840266234?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2V5AoRLEl6Y4UmUF6FOmy1Wp418/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2V5AoRLEl6Y4UmUF6FOmy1Wp418/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2V5AoRLEl6Y4UmUF6FOmy1Wp418/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2V5AoRLEl6Y4UmUF6FOmy1Wp418/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/GsAbYIZgA5Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/4940578819840266234/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/10/wine-advisor-my-first-paid-app-is-now.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4940578819840266234?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4940578819840266234?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/GsAbYIZgA5Q/wine-advisor-my-first-paid-app-is-now.html" title="Wine Advisor, my first paid app is now available on the Android Market." /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Q-JSg53A3nM/TMOlrIzyCkI/AAAAAAAAKc4/ARKyLtSLbts/s72-c/wino2_500px.png" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/10/wine-advisor-my-first-paid-app-is-now.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEAASX08eyp7ImA9Wx5UEk4.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-4607056198154448317</id><published>2010-10-14T12:43:00.000+11:00</published><updated>2010-10-17T00:45:48.373+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-17T00:45:48.373+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><category scheme="http://www.blogger.com/atom/ns#" term="Spinner" /><category scheme="http://www.blogger.com/atom/ns#" term="xml" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>Spinner down arrow stretching?</title><content type="html">&lt;b&gt;.. Styling the inner and outer views of a Spinner individually.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I was working with a Spinner with a lot of rows fetched from a database, and wanted to put a bit of padding around each item to make it easier for the user to select them.&lt;br /&gt;
&lt;br /&gt;
So I went into my res\layout\spinner_view_row.xml (which controls how the Spinner rows display) and added this:   &lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: monospace; white-space: pre;"&gt;                   &lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;android:padding="5dip"&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Then, when I went and re-ran my app, what used to look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TLZWnPNLYHI/AAAAAAAAKcI/s6QvwZO08M0/s1600/normalSpinner.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TLZWnPNLYHI/AAAAAAAAKcI/s6QvwZO08M0/s1600/normalSpinner.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;.. now looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TLZWn1sUixI/AAAAAAAAKcM/MDqvXhLFTZ8/s1600/stretchedSpinner.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TLZWn1sUixI/AAAAAAAAKcM/MDqvXhLFTZ8/s1600/stretchedSpinner.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="color: #93c47d;"&gt;.. Ooops.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
Looks like a condom doesn't it. Not what I was trying to achieve, really. If I made the padding large enough, it will also look like that before I've even selected anything.&lt;br /&gt;
&lt;br /&gt;
Not what I wanted at all.&lt;br /&gt;
&lt;br /&gt;
But I do want that padding around each item in my Spinner, otherwise my users will have too much trouble choosing items from my latest super-dooper, take-the-world-by-storm, #1 in the world market app, and it might not stay #1 for long at all.&lt;br /&gt;
&lt;br /&gt;
Luckily, the answer is really, really simple.&lt;br /&gt;
&lt;br /&gt;
You might recogise the below as the piece of code that binds a cursor from the database (containing all the items we want to display), to the xml view&amp;nbsp;&lt;b&gt;spinner_view_row&lt;/b&gt;, located at&amp;nbsp;&amp;nbsp;&lt;b&gt;res\layout\spinner_view_row.xml &lt;/b&gt;(this is the xml file in which we put the extra padding,&amp;nbsp;above).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;  final SimpleCursorAdapter ingredientAdapter =
  new SimpleCursorAdapter(this, &lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;span class="pln"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;android&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="pun"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="pln"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;R&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="pun"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="pln"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;layout&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="pun"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="pln"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;simple_spinner_item&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;, ingredientsCursor, from, to); 
  ingredientAdapter.setDropDownViewResource(R.layout.spinner_view_row);

  spnIngredients.setAdapter(ingredientAdapter);&lt;/span&gt;&lt;/b&gt;
&lt;/pre&gt;&lt;br /&gt;
All we need to do to avoid the stretchy condom spinner arrow is to define another xml view in&amp;nbsp;&lt;b&gt;res\layout\ &lt;/b&gt;and call it something like&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-family: monospace; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;spinner_view_closed&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;, then paste into it the same code that you have in&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: monospace; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;spinner_view_row&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;. &lt;br /&gt;
Simply then customise this xml to have less padding, or a smaller text size for instance, then replace the reference to &lt;br /&gt;
&lt;pre&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;simple_spinner_item&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;with a reference to this new xml file, like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;  final SimpleCursorAdapter ingredientAdapter =
  new SimpleCursorAdapter(this, &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="color: #e69138;"&gt;R.layout.spinner_view_row_closed&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;, ingredientsCursor, from, to); 
  ingredientAdapter.setDropDownViewResource(R.layout.spinner_view_row);

  spnIngredients.setAdapter(ingredientAdapter);&lt;/b&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
.. and your new Spinner will look like this when open:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TLZelNn4-6I/AAAAAAAAKcU/KNgQNJabHcw/s1600/newSpinner_open.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TLZelNn4-6I/AAAAAAAAKcU/KNgQNJabHcw/s1600/newSpinner_open.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
.. and this when closed.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TLZep-5rSqI/AAAAAAAAKcY/-fI-G7g9tgQ/s1600/newSpinner.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TLZep-5rSqI/AAAAAAAAKcY/-fI-G7g9tgQ/s1600/newSpinner.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Easy eh?&lt;br /&gt;
.. Told you so.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-4607056198154448317?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wnQQYv1JrSoxmTaNyrmZT6teDbs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wnQQYv1JrSoxmTaNyrmZT6teDbs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wnQQYv1JrSoxmTaNyrmZT6teDbs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wnQQYv1JrSoxmTaNyrmZT6teDbs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/Pa8KGMsgETQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/4607056198154448317/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/10/spinner-down-arrow-stretching.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4607056198154448317?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4607056198154448317?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/Pa8KGMsgETQ/spinner-down-arrow-stretching.html" title="Spinner down arrow stretching?" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Q-JSg53A3nM/TLZWnPNLYHI/AAAAAAAAKcI/s6QvwZO08M0/s72-c/normalSpinner.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/10/spinner-down-arrow-stretching.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQGQ3czeyp7ImA9Wx5VEUU.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-2891879383108794836</id><published>2010-10-04T21:11:00.003+11:00</published><updated>2010-10-04T21:15:22.983+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-04T21:15:22.983+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="news" /><title>Android Market expands: More Countries, More sellers, More buyers</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TKmoIW4SoqI/AAAAAAAAKbM/b-4dd4HVZIU/s1600/market-bag-intl4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TKmoIW4SoqI/AAAAAAAAKbM/b-4dd4HVZIU/s1600/market-bag-intl4.png" /&gt;&lt;/a&gt;&lt;/div&gt;Support for paid Android application sales is now expanded to developers in 29 countries, with the addition of Argentina, Australia, Belgium, Brazil, Canada, Denmark, Finland, Hong Kong, Ireland, Israel, Mexico, New Zealand, Norway, Portugal, Russia, Singapore, South Korea, Sweden, Switzerland and Taiwan.&lt;br /&gt;
&lt;br /&gt;
In addition, Android Market users from 32 countries will be able to buy apps, with the addition of Argentina, Belgium, Brazil, Czech Republic, Denmark, Finland, Hong Kong, India, Ireland, Israel, Mexico, Norway, Poland, Portugal, Russia, Singapore, Sweden, and Taiwan.&lt;br /&gt;
&lt;br /&gt;
.. Get programming people!&lt;br /&gt;
&lt;br /&gt;
Official blurb &lt;a href="http://android-developers.blogspot.com/2010/09/more-countries-more-sellers-more-buyers.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-2891879383108794836?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YzZBcXRl_0HlgM-LexwEqnFn-WM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YzZBcXRl_0HlgM-LexwEqnFn-WM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YzZBcXRl_0HlgM-LexwEqnFn-WM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YzZBcXRl_0HlgM-LexwEqnFn-WM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/BvZjA2_PZE0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/2891879383108794836/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/10/more-countries-more-sellers-more-buyers.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/2891879383108794836?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/2891879383108794836?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/BvZjA2_PZE0/more-countries-more-sellers-more-buyers.html" title="Android Market expands: More Countries, More sellers, More buyers" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_Q-JSg53A3nM/TKmoIW4SoqI/AAAAAAAAKbM/b-4dd4HVZIU/s72-c/market-bag-intl4.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/10/more-countries-more-sellers-more-buyers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IGQXY-eSp7ImA9Wx5VFkU.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-1086505417487151518</id><published>2010-10-04T18:42:00.008+11:00</published><updated>2010-10-10T15:38:40.851+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-10T15:38:40.851+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="keyboard" /><category scheme="http://www.blogger.com/atom/ns#" term="EditText" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>Using EditText's inputType to control what type of keyboard is shown</title><content type="html">As software developers, there are many circumstances in which you'll want to limit the input options available to your users. We've all seen situations along the lines of the person who enters '&lt;b&gt;two&lt;/b&gt;' in a field where we've only been expecting the number &lt;b&gt;2&lt;/b&gt;. Oh how that screws things up! Oh the laughs we've had eh?&lt;br /&gt;
&lt;br /&gt;
Fortunately, in Android it's easy to gently&amp;nbsp;shepherd&amp;nbsp;our precious users to input the sort of data we're expecting, and we do that with the&amp;nbsp;&lt;b&gt;editText's inputType&lt;/b&gt; attribute.&lt;br /&gt;
&lt;br /&gt;
You can set your editText inputType as ‘&lt;b&gt;Phone&lt;/b&gt;’ for example, and the user can able to type only numbers. If it is ‘&lt;b&gt;Time&lt;/b&gt;’ it will allow only time related characters to be entered. Handy eh?&lt;br /&gt;
&lt;br /&gt;
There are many options, and I've included (what I think is) all of them at the end of this post for your pleasure.&lt;br /&gt;
&lt;br /&gt;
In the meantime, here are some examples that will hopefully illustrate this option:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;        &amp;lt;EditText android:id="@+id/etWidth1"
            android:hint="@string/widthLabel"
            android:minWidth="75dip"
            android:inputType="textCapWords"
            android:lines="1"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"&amp;gt;
        &amp;lt;/EditText&amp;gt;&lt;/b&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TKl6jKBKGTI/AAAAAAAAKa4/qQJ443wRGaw/s1600/textCapWords.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="287" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TKl6jKBKGTI/AAAAAAAAKa4/qQJ443wRGaw/s320/textCapWords.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;notice the capitalised first letter of the each sentence, that happens automatically!&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;        &amp;lt;EditText android:id="@+id/etWidth1"
            android:hint="@string/widthLabel"
            android:minWidth="75dip"
            android:inputType="textCapCharacters"
            android:lines="1"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"&amp;gt;
        &amp;lt;/EditText&amp;gt;&lt;/b&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_Q-JSg53A3nM/TKl6krJhzYI/AAAAAAAAKa8/34u-hWRez5Q/s1600/textCapCharacters.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="285" src="http://2.bp.blogspot.com/_Q-JSg53A3nM/TKl6krJhzYI/AAAAAAAAKa8/34u-hWRez5Q/s320/textCapCharacters.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;        &amp;lt;EditText android:id="@+id/etWidth1"
            android:hint="@string/widthLabel"
            android:minWidth="75dip"
            android:inputType="text"
            android:lines="1"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"&amp;gt;
        &amp;lt;/EditText&amp;gt;&lt;/b&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TKl6ngNQCJI/AAAAAAAAKbA/IrtoQ-_t-Es/s1600/text.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="236" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TKl6ngNQCJI/AAAAAAAAKbA/IrtoQ-_t-Es/s320/text.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ok, so nothing special to see here..&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;        &amp;lt;EditText android:id="@+id/etWidth1"
            android:hint="@string/widthLabel"
            android:minWidth="75dip"
            android:inputType="phone"
            android:lines="1"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"&amp;gt;
        &amp;lt;/EditText&amp;gt;&lt;/b&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TKl6pZNRv-I/AAAAAAAAKbE/xdZ27f_f3K8/s1600/phone.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="236" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TKl6pZNRv-I/AAAAAAAAKbE/xdZ27f_f3K8/s320/phone.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;pre class="source-code"&gt;&lt;code&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;        &amp;lt;EditText android:id="@+id/etWidth1"
            android:hint="@string/widthLabel"
            android:minWidth="75dip"
            android:inputType="textUri"
            android:lines="1"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"&amp;gt;
        &amp;lt;/EditText&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TKl6rO_55ZI/AAAAAAAAKbI/3D9fms3Qvi8/s1600/textUri.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="246" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TKl6rO_55ZI/AAAAAAAAKbI/3D9fms3Qvi8/s320/textUri.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Remember, limiting the allowable input characters is only one part of good design. &lt;br /&gt;
&lt;br /&gt;
You still need to run a sanity check on all fields that allow the user to enter data. &lt;br /&gt;
&lt;br /&gt;
This is absolutely essential in many, many situations. Do a google search for 'sql injection' for more information on how unsafe fields can result in your entire system being vulnerable.&lt;br /&gt;
&lt;br /&gt;
Here is (what I think is) the full list of EditText InputTypes available to you :&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: #0b5394; left: 100px; position: relative;"&gt;text&lt;br /&gt;
textCapCharacters&lt;br /&gt;
textCapWords&lt;br /&gt;
textCapSentences&lt;br /&gt;
textAutoCorrect&lt;br /&gt;
textAutoComplete&lt;br /&gt;
textMultiLine&lt;br /&gt;
textImeMultiLine&lt;br /&gt;
textNoSuggestions&lt;br /&gt;
textUri&lt;br /&gt;
textEmailAddress&lt;br /&gt;
textEmailSubject&lt;br /&gt;
textShortMessage&lt;br /&gt;
textLongMessage&lt;br /&gt;
textPersonName&lt;br /&gt;
textPostalAddress&lt;br /&gt;
textPassword&lt;br /&gt;
textVisiblePassword&lt;br /&gt;
textWebEditText&lt;br /&gt;
textFilter&lt;br /&gt;
textPhonetic&lt;br /&gt;
number&lt;br /&gt;
numberSigned&lt;br /&gt;
numberDecimal&lt;br /&gt;
phone&lt;br /&gt;
datetime&lt;br /&gt;
date&lt;br /&gt;
time&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-1086505417487151518?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HqMBK29OtAoJ5aU27jNwUlMyQFU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HqMBK29OtAoJ5aU27jNwUlMyQFU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HqMBK29OtAoJ5aU27jNwUlMyQFU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HqMBK29OtAoJ5aU27jNwUlMyQFU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/NvevRA_62V0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/1086505417487151518/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/10/using-edittexts-inputtype-to-control.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1086505417487151518?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1086505417487151518?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/NvevRA_62V0/using-edittexts-inputtype-to-control.html" title="Using EditText's inputType to control what type of keyboard is shown" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_Q-JSg53A3nM/TKl6jKBKGTI/AAAAAAAAKa4/qQJ443wRGaw/s72-c/textCapWords.png" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/10/using-edittexts-inputtype-to-control.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEAASX08fSp7ImA9Wx5UEk4.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-3245383387628302014</id><published>2010-08-01T00:51:00.002+10:00</published><updated>2010-10-17T00:45:48.375+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-17T00:45:48.375+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><category scheme="http://www.blogger.com/atom/ns#" term="Spinner" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>Using spinner.setSelection &amp; finding the spinner doesn't show the selected item when closed?</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TFQ39s1mJSI/AAAAAAAAKLk/8P53S7KmFP8/s1600/spinning_top.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="297" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TFQ39s1mJSI/AAAAAAAAKLk/8P53S7KmFP8/s320/spinning_top.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;Ok, I've just spent a couple of hours trying to figure this out, and now I have, I thought I'd share the incredibly simple solution with you.&lt;br /&gt;
&lt;br /&gt;
The issue: I was needing to set a Spinner's &lt;b&gt;selected item&lt;/b&gt; via code, but found when calling the Spinner's &lt;b&gt;setSelection&lt;/b&gt; method and passing in the position to set it to, something odd would happen, the closed spinner would appear blank, yet, when clicking on it, the item I've asked to be selected would be correctly located at the top of the spinner.&lt;br /&gt;
&lt;br /&gt;
It looks like a Spinner is not told to redraw when using &lt;b&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;.setSelection(position)&lt;/span&gt;&lt;/b&gt;, what you have to do is call &lt;b&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;.setSelection(int position, boolean animate)&lt;/span&gt;&lt;/b&gt; unless you want your selection to happen silently behind the scenes.&lt;br /&gt;
&lt;br /&gt;
Odd, but easily sorted out.&lt;br /&gt;
&lt;br /&gt;
The incredibly simple solution:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;T&lt;/span&gt;his &lt;b&gt;won't&lt;/b&gt; show the fact that the Spinner selection has been set:&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;spnIngredients.setAdapter(ingredientAdapter);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;spnIngredients.setSelection(position);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This will:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;span class="Apple-style-span" style="color: #073763;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;spnIngredients.setAdapter(ingredientAdapter);&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #073763;"&gt;spnIngredients.setSelection(pos, true);&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope that helps someone out there.&lt;br /&gt;
.. Happy Spinning.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TFQ5lys1mTI/AAAAAAAAKLo/HJVchuoy_0A/s1600/spinning.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TFQ5lys1mTI/AAAAAAAAKLo/HJVchuoy_0A/s320/spinning.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-3245383387628302014?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5yXeK8PQOWIWN6VM_gF5sAZdTEY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5yXeK8PQOWIWN6VM_gF5sAZdTEY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5yXeK8PQOWIWN6VM_gF5sAZdTEY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5yXeK8PQOWIWN6VM_gF5sAZdTEY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/muNIbFAVmcs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/3245383387628302014/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/08/using-spinnersetselection-finding.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/3245383387628302014?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/3245383387628302014?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/muNIbFAVmcs/using-spinnersetselection-finding.html" title="Using spinner.setSelection &amp; finding the spinner doesn't show the selected item when closed?" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Q-JSg53A3nM/TFQ39s1mJSI/AAAAAAAAKLk/8P53S7KmFP8/s72-c/spinning_top.jpg" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/08/using-spinnersetselection-finding.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IGQ3Y6cCp7ImA9WxFbGU4.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-6687494528077223583</id><published>2010-07-12T21:09:00.003+10:00</published><updated>2010-07-12T21:52:02.818+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-12T21:52:02.818+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Google App Inventor" /><title>Google App Inventor: Android for Beginners for absolute beginners!</title><content type="html">Today Google announced a simple-to-use DIY app maker called Google App Inventor. &lt;br /&gt;
&lt;br /&gt;
Google App Inventor brings Android development to non-programmers, employing a design scheme that relies on visual blocks rather than writing pages of code, the App Inventor -- In true Google style, still in Beta, of course -- has functions for just about anything you can do with an Android handset, including access to GPS and phone functionality. &lt;br /&gt;
&lt;br /&gt;
I can imagine this would be fantastic in classrooms.&lt;br /&gt;
&lt;br /&gt;
more information here: &lt;a href="http://appinventor.googlelabs.com/about/"&gt;http://appinventor.googlelabs.com/about/&lt;/a&gt;&lt;br /&gt;
complete this form to apply for access: &lt;a href="https://services.google.com/fb/forms/appinventorinterest/"&gt;https://services.google.com/fb/forms/appinventorinterest/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;object height="240" width="400"&gt;&lt;param name="movie" value="http://www.youtube.com/v/8ADwPLSFeY8&amp;color1=0xb1b1b1&amp;color2=0xd0d0d0&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/8ADwPLSFeY8&amp;color1=0xb1b1b1&amp;color2=0xd0d0d0&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="400" height="240"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
Tre Cool!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-6687494528077223583?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TLsIhkrn3odKVHXJo1lJET7Fb68/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TLsIhkrn3odKVHXJo1lJET7Fb68/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TLsIhkrn3odKVHXJo1lJET7Fb68/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TLsIhkrn3odKVHXJo1lJET7Fb68/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/Xru8-G33spU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/6687494528077223583/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/07/google-app-inventor-brings-android.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6687494528077223583?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6687494528077223583?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/Xru8-G33spU/google-app-inventor-brings-android.html" title="Google App Inventor: Android for Beginners for absolute beginners!" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/07/google-app-inventor-brings-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEFQnszfCp7ImA9WhZVEEg.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-1603675038808267967</id><published>2010-06-29T22:55:00.003+10:00</published><updated>2011-05-22T18:56:53.584+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-22T18:56:53.584+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="background images" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="coding tips" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><category scheme="http://www.blogger.com/atom/ns#" term="how-to" /><title>How to tile a background image in Android</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/TCnufKgkzrI/AAAAAAAAKDg/Bek0MUtmnhQ/s1600/tiling.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/TCnufKgkzrI/AAAAAAAAKDg/Bek0MUtmnhQ/s320/tiling.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;For one of the apps I'm working on I wanted to have a nice pixel pattern tiled behind my widgets.&lt;br /&gt;
After a little bit of hunting around I found &lt;a href="http://androidblogger.blogspot.com/2009/01/how-to-have-tiled-background-cont.html"&gt;this tutorial&lt;/a&gt;, and I thought I'd clean up the lessons within and show you how.&lt;br /&gt;
&lt;br /&gt;
Here's the contents of my main.xml layout file,&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #990000;"&gt;android:background="@drawable/backrepeat"&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;
    android:gravity="center_horizontal"
    &amp;gt;
&amp;lt;TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    /&amp;gt; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
which is referenced in code in the standard way like this:&lt;br /&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;
&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.&lt;span class="Apple-style-span" style="color: #990000;"&gt;main&lt;/span&gt;);
&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="source-code"&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;...// (rest of onCreate method continues here..)&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Now note this line:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #990000;"&gt;android:background="@drawable/backrepeat"&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What's going on there?&lt;br /&gt;
.. Glad you asked!&lt;br /&gt;
&lt;br /&gt;
Here's a quick screenshot of the contents of one of my drawable folders in my project:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_Q-JSg53A3nM/TCnpCgz4PSI/AAAAAAAAKDI/i-GcB69WjUQ/s1600/drawableFolder.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_Q-JSg53A3nM/TCnpCgz4PSI/AAAAAAAAKDI/i-GcB69WjUQ/s320/drawableFolder.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
What is this &lt;br /&gt;
&lt;code&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;backrepeat.xml&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;?&lt;br /&gt;
&lt;br /&gt;
Well, here's the contents of that file here:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;&amp;lt;bitmap&lt;br /&gt;
xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;
android:src="@drawable/scale1"&lt;br /&gt;
android:tileMode="repeat"&lt;br /&gt;
android:dither="true" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Can you see what's going on?&lt;br /&gt;
Backrepeat.xml defines an instance of the&amp;nbsp;&lt;a href="http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html"&gt;BitmapDrawable&lt;/a&gt;&amp;nbsp;class, and that class references our simple scale1.jpg, located in the drawable-hdpi folder.&lt;br /&gt;
&lt;br /&gt;
Simply by adding the:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;&amp;lt;bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/scale1"
    &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #990000;"&gt;android:tileMode="repeat"&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;&lt;b&gt;
    android:dither="true" /&amp;gt;&lt;/b&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
line in bold, we are able to achieve results such as this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_Q-JSg53A3nM/TCnrPKE-dDI/AAAAAAAAKDY/UGRKbvSD938/s1600/tiledBackground.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_Q-JSg53A3nM/TCnrPKE-dDI/AAAAAAAAKDY/UGRKbvSD938/s320/tiledBackground.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
Easy isn't it?&lt;br /&gt;
&lt;br /&gt;
One thing to keep in mind is that you should have folders drawable-hdpi, drawable-mdpi &amp;amp; drawable-ldpi, you'll need to add this backrepeat.xml file and the relevant images to each of these to allow this functionality in high, medium and low dpi (dots per inch) screen sizes.&lt;br /&gt;
&lt;br /&gt;
Enjoy.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-1603675038808267967?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PHm8F5u2PQFZL_Y84gfaUTiHexg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PHm8F5u2PQFZL_Y84gfaUTiHexg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PHm8F5u2PQFZL_Y84gfaUTiHexg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PHm8F5u2PQFZL_Y84gfaUTiHexg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/IPFzil_Eq1w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/1603675038808267967/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/06/how-to-tile-background-image-in-android.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1603675038808267967?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/1603675038808267967?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/IPFzil_Eq1w/how-to-tile-background-image-in-android.html" title="How to tile a background image in Android" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Q-JSg53A3nM/TCnufKgkzrI/AAAAAAAAKDg/Bek0MUtmnhQ/s72-c/tiling.jpg" height="72" width="72" /><thr:total>10</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/06/how-to-tile-background-image-in-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0AAQnk4cCp7ImA9Wx5bE0k.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-5616454537316463554</id><published>2010-06-19T20:02:00.014+10:00</published><updated>2010-10-29T19:42:23.738+11:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-29T19:42:23.738+11:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="L10n and i10n" /><category scheme="http://www.blogger.com/atom/ns#" term="internationalisation" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="localisation" /><title>Localisation &amp; Internationalisation on Android, the easy way</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TByUSR_ZQrI/AAAAAAAAKA0/KQalslH7Ky0/s1600/pic_ie10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TByUSR_ZQrI/AAAAAAAAKA0/KQalslH7Ky0/s320/pic_ie10.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TByUSR_ZQrI/AAAAAAAAKA0/KQalslH7Ky0/s1600/pic_ie10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;You often hear about &lt;b&gt;Internationalisation&lt;/b&gt; (internationalization in US English, or &lt;b&gt;i18n&lt;/b&gt; for short), and &lt;b&gt;Localisation&lt;/b&gt; (Localization in US English, or &lt;b&gt;L10n&lt;/b&gt; for short) in software development circles... ever wonder what that's all about?&lt;br /&gt;
&lt;br /&gt;
Of &lt;i&gt;course&lt;/i&gt; you do.&lt;br /&gt;
&lt;br /&gt;
Definitions vary, but the basic idea is generally easily summarised:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Internationalisation is the process of designing a software application so that it can be adapted to &lt;b&gt;&lt;i&gt;various&lt;/i&gt; languages and regions&lt;/b&gt; without engineering changes.&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Localisation is the process of adapting internationalized software for a &lt;b&gt;&lt;i&gt;specific&lt;/i&gt;&lt;/b&gt; region or language by adding locale-specific components and translating text.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
These two terms usually go hand-in-hand as the term '&lt;b&gt;globalisation&lt;/b&gt;'. See?&lt;br /&gt;
.. Course you do.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each language is given a language code such as '&lt;b&gt;en-au&lt;/b&gt;' for Australian English, or '&lt;b&gt;en-us&lt;/b&gt;' for American English. These language codes are two-letter lowercase ISO language codes (such as "en") as defined by &lt;a href="http://en.wikipedia.org/wiki/ISO_639-1"&gt;ISO 639-1&lt;/a&gt;.&lt;br /&gt;
But how do we use this? And how can we easily apply these concepts to our Android programming?&lt;br /&gt;
&lt;br /&gt;
.. Good question!&lt;br /&gt;
&lt;br /&gt;
Best practices in Android suggests defining all your string resources in a '&lt;b&gt;strings.xml&lt;/b&gt;' file (you're doing this already, right?) and placing that file in the 'res\values' folder in your project.&lt;br /&gt;
&lt;br /&gt;
Localisation in Android is as simple as creating a new version of this file and folder, renaming the 'values'&amp;nbsp;folder to 'values' + the language code you wish to support.&lt;br /&gt;
&lt;br /&gt;
For example, all your Italian translations would be located in '&lt;b&gt;res\values-it\strings.xml&lt;/b&gt;', your Chinese translations in&amp;nbsp;'&lt;b&gt;res\values-zh\strings.xml&lt;/b&gt;' as seen here:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/TMqH636sTbI/AAAAAAAAKfE/tnEX_WZpXQY/s1600/Screenshot-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/TMqH636sTbI/AAAAAAAAKfE/tnEX_WZpXQY/s400/Screenshot-1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
If you don't happen to have a friend from whatever country you're trying to translate your app for, just use &lt;a href="http://translate.google.com/"&gt;Google translate&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
Once you're done your app is one simple step away from global domination.&lt;br /&gt;
&lt;br /&gt;
All you need to do is copy those freshly translate strings back into a strings.xml file in Eclipse, and, as long as the folder the strings.xml file is located in has the name of '&lt;b&gt;values&lt;/b&gt;' + the language code you're wishing to support, magically any user who has their phone locale set to a locale that uses that language, your translated strings will be used.&lt;br /&gt;
&lt;br /&gt;
No code changes are required.&lt;br /&gt;
&lt;br /&gt;
Handy eh?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-5616454537316463554?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9ObhoA74tWvotL_m1IC8h4QE4VE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9ObhoA74tWvotL_m1IC8h4QE4VE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9ObhoA74tWvotL_m1IC8h4QE4VE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9ObhoA74tWvotL_m1IC8h4QE4VE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/pSPfBfuhWOU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/5616454537316463554/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/06/localisation-internationalisation-on.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/5616454537316463554?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/5616454537316463554?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/pSPfBfuhWOU/localisation-internationalisation-on.html" title="Localisation &amp; Internationalisation on Android, the easy way" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_Q-JSg53A3nM/TByUSR_ZQrI/AAAAAAAAKA0/KQalslH7Ky0/s72-c/pic_ie10.jpg" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/06/localisation-internationalisation-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cMQns8eyp7ImA9Wx5QFE8.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-2739985782788147350</id><published>2010-06-06T23:04:00.003+10:00</published><updated>2010-09-02T22:04:43.573+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-02T22:04:43.573+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="installing Apk apps" /><title>My first App is now available on the Android market, free.</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Q-JSg53A3nM/TAub3EwBhmI/AAAAAAAAJ_g/lRHE31WeIsE/s1600/AspectRatioCalculator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_Q-JSg53A3nM/TAub3EwBhmI/AAAAAAAAJ_g/lRHE31WeIsE/s320/AspectRatioCalculator.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a href="http://www.androidzoom.com/android_applications/tools/aspect-ratio-calculator_hlxa.html"&gt;Aspect Ratio Calculator&lt;/a&gt;&amp;nbsp;is a simple tool that makes it easy to calculate the dimensions to resize an image. &lt;br /&gt;
&lt;br /&gt;
Great for graphic designers, or anyone resizing images for blogging, it's available in Spanish, Russian, Portuguese, Chinese &amp;amp; Italian.&lt;br /&gt;
&lt;br /&gt;
.. And of course, English ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-2739985782788147350?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/EoacP3CkE2wT6LM53Zu6QOCJW6o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EoacP3CkE2wT6LM53Zu6QOCJW6o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/EoacP3CkE2wT6LM53Zu6QOCJW6o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EoacP3CkE2wT6LM53Zu6QOCJW6o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/Yp7usQdi5Ss" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/2739985782788147350/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/06/my-first-app-is-now-available-on.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/2739985782788147350?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/2739985782788147350?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/Yp7usQdi5Ss/my-first-app-is-now-available-on.html" title="My first App is now available on the Android market, free." /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_Q-JSg53A3nM/TAub3EwBhmI/AAAAAAAAJ_g/lRHE31WeIsE/s72-c/AspectRatioCalculator.png" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/06/my-first-app-is-now-available-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08MRng4fCp7ImA9WxFREUs.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-6762254540907245359</id><published>2010-04-25T12:15:00.002+10:00</published><updated>2010-04-25T12:18:07.634+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-25T12:18:07.634+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="books" /><title>Book Review: Professional Android 2 Application Development</title><content type="html">&lt;div style="text-align: center;"&gt;&lt;a href="http://www.amazon.com/Professional-Android-Application-Development-Programmer/dp/0470565527?ie=UTF8&amp;amp;tag=andwornew-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Professional Android 2 Application Development (Wrox Programmer to Programmer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0470565527&amp;amp;tag=andwornew-20" /&gt;&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=andwornew-20&amp;amp;l=bil&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0470565527" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;&lt;/div&gt;&lt;br /&gt;
Written by an Android authority, this up-to-date resource shows you how to leverage the features of Android 2 to enhance existing products or create innovative new ones.&lt;br /&gt;
&lt;br /&gt;
Serving as a hands-on guide to building mobile apps using Android, the book walks you through a series of sample projects that introduces you to Android's new features and techniques.&lt;br /&gt;
&lt;br /&gt;
It is perhaps one of the most in-depth Android books available, and is also very regularly updated, currently covering Android SDK 2.1 r1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Book's author, Reto Meier is a software developer who has been involved in Android since the initial release in 2007. He is an Android Developer Advocate at Google.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-6762254540907245359?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5_9F5wen9rR5dCK4ADWxGB9vVMY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5_9F5wen9rR5dCK4ADWxGB9vVMY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5_9F5wen9rR5dCK4ADWxGB9vVMY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5_9F5wen9rR5dCK4ADWxGB9vVMY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/nT_PjJH4M7Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/6762254540907245359/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/04/book-review-professional-android-2.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6762254540907245359?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/6762254540907245359?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/nT_PjJH4M7Y/book-review-professional-android-2.html" title="Book Review: Professional Android 2 Application Development" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/04/book-review-professional-android-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYFRnk9eip7ImA9WxFSFkU.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-5173270375618479913</id><published>2010-04-19T23:17:00.002+10:00</published><updated>2010-04-19T23:18:37.762+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-19T23:18:37.762+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="video" /><category scheme="http://www.blogger.com/atom/ns#" term="games" /><title>Writing Real-Time Games for Android - Google I/O 2009</title><content type="html">&lt;div style="position:relative; left:-20px;"&gt;&lt;object width="440" height="356"&gt;&lt;param name="movie" value="http://www.youtube.com/v/U4Bk5rmIpic&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/U4Bk5rmIpic&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="440" height="356"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Do vertex arrays keep you up at night? Do you have nightmares involving frame rates and event loops? If so, this session might have the cure for your condition. &lt;br /&gt;
&lt;br /&gt;
Chris Pruett will discuss the game engine that he developed, using it as a case study to explain the common pitfalls and best practices for building graphics-intensive applications. You'll learn how to properly pipeline game and rendering code, manage drawing surfaces, and incorporate 2D and 3D graphics cleanly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-5173270375618479913?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hGWun34ixb__LUJ8VmqVHPDsvmI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hGWun34ixb__LUJ8VmqVHPDsvmI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hGWun34ixb__LUJ8VmqVHPDsvmI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hGWun34ixb__LUJ8VmqVHPDsvmI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/lDsMxfOpAeQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/5173270375618479913/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/04/writing-real-time-games-for-android.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/5173270375618479913?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/5173270375618479913?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/lDsMxfOpAeQ/writing-real-time-games-for-android.html" title="Writing Real-Time Games for Android - Google I/O 2009" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/04/writing-real-time-games-for-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkANSXo8cCp7ImA9WxFSFUg.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-3825360888068940401</id><published>2010-04-13T22:51:00.001+10:00</published><updated>2010-04-18T12:46:38.478+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-18T12:46:38.478+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Context" /><category scheme="http://www.blogger.com/atom/ns#" term="components" /><title>Some notes about Android Context</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/S8RG05KU4yI/AAAAAAAAJFo/YJvC1DNYtSM/s1600/Contexts.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Q-JSg53A3nM/S8MbpvBiEBI/AAAAAAAAJFk/5uI_-mu__rg/s1600/context2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="256" src="http://4.bp.blogspot.com/_Q-JSg53A3nM/S8MbpvBiEBI/AAAAAAAAJFk/5uI_-mu__rg/s320/context2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/S8MbpC_AVrI/AAAAAAAAJFg/qIYqanTqEjQ/s1600/Context.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="256" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/S8MbpC_AVrI/AAAAAAAAJFg/qIYqanTqEjQ/s320/Context.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Context is an interface to global information about an application environment. It's an abstract class whose implementation is provided by the Android system.&lt;br /&gt;
&lt;br /&gt;
Context allows access to application-specific resources and classes, as well as calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.&lt;br /&gt;
&lt;br /&gt;
All the widgets receive a Context parameter in their constructor. In a regular Android application, you usually have two kinds of Context, &lt;b&gt;Activity&lt;/b&gt; and &lt;b&gt;Application&lt;/b&gt;. It's usually an Activity Context that the developer passes to classes and methods that need a Context.&lt;br /&gt;
&lt;br /&gt;
Basically the Application context is associated with the Application and will always be the same throughout the life cycle of your app, where as the Activity context is associated with the activity and could possible be destroyed many times as the activity is destroyed during screen orientation changes and such.&lt;br /&gt;
&lt;br /&gt;
In particular you should be careful when dealing with anything that deals with the GUI that requires a Context. For example, if you pass the application Context into the LayoutInflator you will get an Exception. It's good practice to use an Activity's Context within that Activity, and the Application Context when passing a context beyond the scope of an Activity to avoid memory leaks.&lt;br /&gt;
&lt;br /&gt;
Here's a quick snippet showing how you can find both the Activity Context and the Application Context:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;b style="color: #0c343d;"&gt;public class MyActivity extends Activity {&lt;br /&gt;
public void aMethod() {&lt;br /&gt;
Context actContext = this;    /*returns the Activity Context since Activity extends Context.*/&lt;br /&gt;
&lt;br /&gt;
Context appContext = getApplicationContext(); /*returns the context of the single, global Application object of the current process. */&lt;br /&gt;
&lt;br /&gt;
Button btnGoToFirstAct = (Button) findViewById(R.id.btnGoToAct1);&lt;br /&gt;
Context vwContext = btnGoToFirstAct.getContext(); /*returns the context of the View. */&lt;br /&gt;
&lt;/b&gt; &lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
When run in the debugger, you can see the results of this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Q-JSg53A3nM/S8RG05KU4yI/AAAAAAAAJFo/YJvC1DNYtSM/s1600/Contexts.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="141" src="http://1.bp.blogspot.com/_Q-JSg53A3nM/S8RG05KU4yI/AAAAAAAAJFo/YJvC1DNYtSM/s320/Contexts.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;Notice that the &lt;b&gt;&lt;code style="color: #0c343d;"&gt;vwContext&lt;/code&gt;&lt;/b&gt; in this case also returns the Activity Context.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope that helps answer some questions. Drop me a message in the comments if you have anything to add.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: right;"&gt;&lt;span style="font-size: 85%;"&gt;&lt;a href="http://developer.android.com/reference/android/content/Context.html" style="font-weight: bold;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-3825360888068940401?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Teh5Qe9vfG-xSVRCoNvIRIQ_UfU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Teh5Qe9vfG-xSVRCoNvIRIQ_UfU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Teh5Qe9vfG-xSVRCoNvIRIQ_UfU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Teh5Qe9vfG-xSVRCoNvIRIQ_UfU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/ZauqVWnKZ7Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/3825360888068940401/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2009/12/context.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/3825360888068940401?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/3825360888068940401?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/ZauqVWnKZ7Y/context.html" title="Some notes about Android Context" /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_Q-JSg53A3nM/S8MbpvBiEBI/AAAAAAAAJFk/5uI_-mu__rg/s72-c/context2.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2009/12/context.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAFR3g7eSp7ImA9WxFSFUg.&quot;"><id>tag:blogger.com,1999:blog-3318629912574060485.post-4498110266996641523</id><published>2010-04-11T12:04:00.002+10:00</published><updated>2010-04-18T12:45:16.601+10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-18T12:45:16.601+10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="video" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorials" /><category scheme="http://www.blogger.com/atom/ns#" term="marketing" /><category scheme="http://www.blogger.com/atom/ns#" term="hints" /><title>Learn what it takes to make a good Android app great.</title><content type="html">&lt;div style="position:relative; left:-20px;"&gt;&lt;object width="440" height="267"&gt;&lt;param name="movie" value="http://www.youtube.com/v/7zKy9iInXkY&amp;hl=en_US&amp;fs=1&amp;color1=0xe1600f&amp;color2=0xfebd01"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/7zKy9iInXkY&amp;hl=en_US&amp;fs=1&amp;color1=0xe1600f&amp;color2=0xfebd01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="267"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Jason, John, and David, mobile industry veterans from Hands-On Mobile, present a technical overview of ways to improve your Android applications stickiness, boost adoption, engage users, and increase monetization and ROI.&lt;br /&gt;
&lt;br /&gt;
This event was hosted by The San Francisco Android User Group at CBS Interactive in San Francisco on August 27th, 2009. The event was sponsored by Hands-On Mobile and organized by Marakana Inc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318629912574060485-4498110266996641523?l=androidforbeginners.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2iT5FwW9EPsJxJJFEI8hlhlc_xA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2iT5FwW9EPsJxJJFEI8hlhlc_xA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2iT5FwW9EPsJxJJFEI8hlhlc_xA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2iT5FwW9EPsJxJJFEI8hlhlc_xA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/IsoLY/~4/fgWcO1VfsGo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://androidforbeginners.blogspot.com/feeds/4498110266996641523/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://androidforbeginners.blogspot.com/2010/04/learn-what-it-takes-to-make-good.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4498110266996641523?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3318629912574060485/posts/default/4498110266996641523?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/IsoLY/~3/fgWcO1VfsGo/learn-what-it-takes-to-make-good.html" title="Learn what it takes to make a good Android app great." /><author><name>Glenn Reilly</name><uri>https://profiles.google.com/115983227599570274496</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-vrFe2bYxCPQ/AAAAAAAAAAI/AAAAAAAAMOs/4Uq4EGWPMyo/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://androidforbeginners.blogspot.com/2010/04/learn-what-it-takes-to-make-good.html</feedburner:origLink></entry></feed>

