<?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;CUEAQHg4fyp7ImA9WhRUFUg.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993</id><updated>2012-01-26T06:54:01.637+02:00</updated><category term="Layout Resources" /><category term="Message" /><category term="SharedPreferences" /><category term="DatePicker" /><category term="SQL" /><category term="Application Strcture" /><category term="DigitalClock" /><category term="RapidFire" /><category term="UI" /><category term="We-Pad" /><category term="Parsing" /><category term="SQLite" /><category term="Apple" /><category term="Alternative Menus" /><category term="Content Providers" /><category term="Hello Android" /><category term="Google Nexus One" /><category term="Gingerbread" /><category term="Table Layout" /><category term="Dalvik Virtual Machine" /><category term="web service" /><category term="Honeycomb" /><category term="Image Resources" /><category term="Dimentions Resources" /><category term="Context Menu" /><category term="TimePickerDialog" /><category term="DOM Parser" /><category term="Handler" /><category term="Android Project Structure" /><category term="Development tools" /><category term="Array Resources" /><category term="SlidingDrawer" /><category term="Threading" /><category term="Service" /><category term="values folder" /><category term="TabWidget" /><category term="MultiAutoCompleteTextView" /><category term="internet connection" /><category term="Images" /><category term="LogCat" /><category term="Tabs" /><category term="DatePickerDialog" /><category term="layout folder" /><category term="Remote Service" /><category term="ToggleButton" /><category term="XML" /><category term="Contacts" /><category term="Styles" /><category term="Options Menu" /><category term="Intents" /><category term="Chronometer" /><category term="TimePicker" /><category term="iPhone" /><category term="Introduction to Android" /><category term="signing" /><category term="ViewFlipper" /><category term="TextView" /><category term="EditText" /><category term="assets folder" /><category term="Cursor" /><category term="Amazon App Store" /><category term="Frame Layout" /><category term="Android 4.0" /><category term="error" /><category term="Sub Menu" /><category term="Linear layout" /><category term="Activity" /><category term="Android Software Stack" /><category term="Layout Properties" /><category term="AnalogClock" /><category term="Contest" /><category term="TabHost" /><category term="Assets" /><category term="RadioButton" /><category term="Space" /><category term="Button" /><category term="Intent Filters" /><category term="iPhone 3GS" /><category term="Currency Converter" /><category term="Themes" /><category term="AsyncTask" /><category term="ScrollView" /><category term="Slide ME" /><category term="Ice Cream Sandwich" /><category term="ImageButton" /><category term="Resources" /><category term="Absolute Layout" /><category term="SSL" /><category term="Applications" /><category term="JSON" /><category term="String Resources" /><category term="AutoCompleteEditText" /><category term="Android" /><category term="Emulator" /><category term="Spinner" /><category term="SAX Parser" /><category term="ListView" /><category term="Gallery" /><category term="Menu" /><category term="Color Resources" /><category term="REST" /><category term="Android 2.3" /><category term="drawable folder" /><category term="GridLayout" /><category term="Nexus Prime" /><category term="Relative Layout" /><category term="HTTPClient" /><category term="Alert" /><category term="src folder" /><category term="Search" /><category term="AIDL" /><category term="SOAP" /><category term="Toast" /><category term="Android 2.2" /><category term="CheckBox" /><category term="Browser" /><category term="gen folder" /><category term="res folder" /><category term="iOS 5" /><category term="Android 3.0" /><title>Learn Android</title><subtitle type="html">A blog to learn Android</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://android-pro.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>90</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/LearnAndroid" /><feedburner:info uri="learnandroid" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DE4FQXo9cSp7ImA9WhRTGEg.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-6690337938437199481</id><published>2011-11-09T18:41:00.000+02:00</published><updated>2011-11-09T18:41:50.469+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-09T18:41:50.469+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Contest" /><title>Winners of the Ice Cream Sandwich VS iOS5 contest</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2LFXbSA8RtJKWMxHrki_olnDFA4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2LFXbSA8RtJKWMxHrki_olnDFA4/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/2LFXbSA8RtJKWMxHrki_olnDFA4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2LFXbSA8RtJKWMxHrki_olnDFA4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Dear readers we are glad to announce the winners of our&amp;nbsp;Ice Cream Sandwich VS iOS5 contest:&lt;br /&gt;
&lt;br /&gt;
The winners of the&lt;b&gt; first&lt;/b&gt; prize: &lt;b&gt;Android a Complete Course:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Jim &lt;/b&gt;from&amp;nbsp;&lt;a href="http://sakiko.com/"&gt;http://sakiko.com/&lt;/a&gt;&lt;br /&gt;
and&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.blogger.com/profile/04325201851097237982" target="_blank"&gt;Believer&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
The winner of the &lt;b&gt;second&lt;/b&gt; prize: &lt;b&gt;Android a Quick Course:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.blogger.com/profile/05724717613575721151" target="_blank"&gt;Corneliu Dascalu&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The winners of the&lt;b&gt; third&lt;/b&gt; prize &lt;b&gt;Android, an Enterprise Edition Vision&lt;/b&gt;:&lt;br /&gt;
&lt;a href="http://www.blogger.com/profile/11125791667492488384" target="_blank"&gt;&lt;b&gt;Will.i.am&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
for the winners please contact me at&amp;nbsp;&lt;a href="mailto:m.s.ramzy@gmail.com"&gt;m.s.ramzy@gmail.com&lt;/a&gt; to send you the copies of the books&lt;br /&gt;
thanks a lot for all the&amp;nbsp;participants&amp;nbsp;and good luck next time.&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/3614313680693372993-6690337938437199481?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/X6Z7vPhGA-o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/6690337938437199481/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/11/winners-of-ice-cream-sandwich-vs-ios5.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/6690337938437199481?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/6690337938437199481?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/X6Z7vPhGA-o/winners-of-ice-cream-sandwich-vs-ios5.html" title="Winners of the Ice Cream Sandwich VS iOS5 contest" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/11/winners-of-ice-cream-sandwich-vs-ios5.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcNSH0_fCp7ImA9WhdaE0w.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-1165674385867903724</id><published>2011-10-22T23:14:00.000+02:00</published><updated>2011-10-22T23:14:59.344+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-22T23:14:59.344+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Android 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Space" /><category scheme="http://www.blogger.com/atom/ns#" term="GridLayout" /><category scheme="http://www.blogger.com/atom/ns#" term="Ice Cream Sandwich" /><title>Ice Cream Sandwich GridLayout</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xiG12NDQbNQEP9PILLn1YBSoU78/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xiG12NDQbNQEP9PILLn1YBSoU78/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/xiG12NDQbNQEP9PILLn1YBSoU78/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xiG12NDQbNQEP9PILLn1YBSoU78/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Android 4.0 (Ice Cream Sandwich) introduced a new type of layouts: the &lt;b&gt;Gridlayout&lt;/b&gt;.&lt;br /&gt;
Gridlayout is like the &lt;b&gt;&amp;lt;Table&amp;gt;&lt;/b&gt; tag in &lt;b&gt;HTML&lt;/b&gt;. child widgets are arranged in &lt;b&gt;Cells&lt;/b&gt; made of &lt;b&gt;Rows&lt;/b&gt; and &lt;b&gt;Columns&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Grid layout is a &lt;b&gt;ViewGroup&lt;/b&gt; that can be used in constructing dashboard activities like that one in the Google Plus application:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/October/gplus.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/October/gplus.jpg" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
so let's see what we can do with the GridLayout:&lt;br /&gt;
we'll construct a simple dashboard layout like this:&lt;/div&gt;&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:rowCount="5"
    android:columnCount="3"
    &amp;gt;

    &amp;lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 1"
        android:layout_row="0"
        android:layout_column="0"
        android:layout_marginLeft="5dp"
         /&amp;gt;
    
    &amp;lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 2"
        android:layout_row="0"
        android:layout_column="1"
        android:layout_margin="5dp" /&amp;gt;
    
    &amp;lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 3"
        android:layout_row="1"
        android:layout_column="0"
        android:layout_margin="5dp" /&amp;gt;
    
    &amp;lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 4"
        android:layout_row="1"
        android:layout_column="1"
        android:layout_margin="5dp" /&amp;gt;
    
    &amp;lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 5"
        android:layout_row="2"
        android:layout_column="0"
        android:layout_margin="5dp" /&amp;gt;
    
    

&amp;lt;/GridLayout&amp;gt;

&lt;/pre&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/October/device1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/October/device1.png" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Widgets are placed in position specified by &lt;b&gt;android:layout_column&lt;/b&gt; and &lt;b&gt;android:layout_row&lt;/b&gt; properties.&lt;br /&gt;
we can organize the widgets in a similar way by using the new &lt;b&gt;Space&lt;/b&gt; View like this:&lt;/div&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;
&amp;lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;
android:layout_width="fill_parent"&lt;br /&gt;
android:layout_height="fill_parent"&lt;br /&gt;
android:rowCount="5"&lt;br /&gt;
android:columnCount="3"&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Space &lt;br /&gt;
android:layout_width="5dp"&lt;br /&gt;
android:layout_height="5dp"/&amp;gt;&lt;br /&gt;
&amp;lt;Button&lt;br /&gt;
android:layout_width="wrap_content"&lt;br /&gt;
android:layout_height="wrap_content"&lt;br /&gt;
android:text="Button 1"&lt;br /&gt;
android:layout_row="0"&lt;br /&gt;
android:layout_column="0"    &lt;br /&gt;
/&amp;gt;&lt;br /&gt;
&amp;lt;Space &lt;br /&gt;
android:layout_width="5dp"&lt;br /&gt;
android:layout_height="5dp"/&amp;gt;&lt;br /&gt;
&amp;lt;Button&lt;br /&gt;
android:layout_width="wrap_content"&lt;br /&gt;
android:layout_height="wrap_content"&lt;br /&gt;
android:text="Button 2"&lt;br /&gt;
android:layout_row="0"&lt;br /&gt;
android:layout_column="1"&lt;br /&gt;
/&amp;gt;&lt;br /&gt;
&amp;lt;Space &lt;br /&gt;
android:layout_width="5dp"&lt;br /&gt;
android:layout_height="5dp"/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Button&lt;br /&gt;
android:layout_width="wrap_content"&lt;br /&gt;
android:layout_height="wrap_content"&lt;br /&gt;
android:text="Button 3"&lt;br /&gt;
android:layout_row="1"&lt;br /&gt;
android:layout_column="0"&lt;br /&gt;
/&amp;gt;&lt;br /&gt;
&amp;lt;Space &lt;br /&gt;
android:layout_width="5dp"&lt;br /&gt;
android:layout_height="5dp"/&amp;gt;&lt;br /&gt;
&amp;lt;Button&lt;br /&gt;
android:layout_width="wrap_content"&lt;br /&gt;
android:layout_height="wrap_content"&lt;br /&gt;
android:text="Button 4"&lt;br /&gt;
android:layout_row="1"&lt;br /&gt;
android:layout_column="1"&lt;br /&gt;
/&amp;gt;&lt;br /&gt;
&amp;lt;Space &lt;br /&gt;
android:layout_width="5dp"&lt;br /&gt;
android:layout_height="5dp"/&amp;gt;&lt;br /&gt;
&amp;lt;Button&lt;br /&gt;
android:layout_width="wrap_content"&lt;br /&gt;
android:layout_height="wrap_content"&lt;br /&gt;
android:text="Button 5"&lt;br /&gt;
android:layout_row="2"&lt;br /&gt;
android:layout_column="0"&lt;br /&gt;
/&amp;gt;&lt;br /&gt;
&amp;lt;Space &lt;br /&gt;
android:layout_width="5dp"&lt;br /&gt;
android:layout_height="5dp"/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/GridLayout&amp;gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/October/device2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/October/device2.png" width="192" /&gt;&lt;/a&gt;&lt;/div&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/3614313680693372993-1165674385867903724?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/X-mzqd5iR5I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/1165674385867903724/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/10/ice-cream-sandwich-gridlayout.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1165674385867903724?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1165674385867903724?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/X-mzqd5iR5I/ice-cream-sandwich-gridlayout.html" title="Ice Cream Sandwich GridLayout" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>4</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/10/ice-cream-sandwich-gridlayout.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkABQHozfyp7ImA9WhdaEkU.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-8246266341009431355</id><published>2011-10-08T22:15:00.001+02:00</published><updated>2011-10-22T13:59:11.487+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-22T13:59:11.487+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Nexus Prime" /><category scheme="http://www.blogger.com/atom/ns#" term="iOS 5" /><category scheme="http://www.blogger.com/atom/ns#" term="Contest" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="Apple" /><category scheme="http://www.blogger.com/atom/ns#" term="Ice Cream Sandwich" /><title>Contest: Do you think Android Ice Cream Sandwich will beat Apple iOS 5</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MkUvzQF62chnQiNhWEJopHpTzFc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MkUvzQF62chnQiNhWEJopHpTzFc/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/MkUvzQF62chnQiNhWEJopHpTzFc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MkUvzQF62chnQiNhWEJopHpTzFc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Hello everybody.&lt;br /&gt;
Google will release the next major Android update: &lt;b&gt;Android 4.0 (Ice cream Sandwich)&lt;/b&gt; along with it's next flagship phone: the &lt;b&gt;Nexus Prime&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Join our &lt;b&gt;Contest &lt;/b&gt;and have the chance to win a copy of one of these wonderful Android books:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://www.android2ee.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=70&amp;amp;Itemid=102&amp;amp;lang=en"&gt;Android, A Complete Course, From Basics To Enterprise Edition.&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://www.android2ee.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=71&amp;amp;Itemid=104&amp;amp;lang=en"&gt;Android, A Quick Course.&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://www.android2ee.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=59&amp;amp;Itemid=105&amp;amp;lang=en"&gt;Android, An Enterprise Edition Vision.&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;&lt;br /&gt;
&lt;a href="http://www.android2ee.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=70&amp;amp;Itemid=102&amp;amp;lang=en" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://www.android2ee.com/images/stories/couv-android/couv-complet-course.jpg" width="141" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;
&lt;a href="http://www.android2ee.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=71&amp;amp;Itemid=104&amp;amp;lang=en" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://www.android2ee.com/images/stories/couv-android/couv-quick-course.jpg" width="141" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;
&lt;a href="http://www.android2ee.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=59&amp;amp;Itemid=105&amp;amp;lang=en" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://www.android2ee.com/images/stories/couv-android/couv-Enterprise.jpg" width="141" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;all you've got to do is to drop a comment answering the following question:&lt;/div&gt;&lt;div&gt;&lt;b&gt;Do you think Android Ice Cream Sandwich will beat Apple iOS 5 ?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div&gt;the contest ends on November 7th, winners will be announced then.&lt;/div&gt;&lt;div&gt;waiting for your comments&lt;/div&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/3614313680693372993-8246266341009431355?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/LLvXxFIyQRY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/8246266341009431355/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/10/contest-do-you-think-android-ice-cream.html#comment-form" title="24 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/8246266341009431355?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/8246266341009431355?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/LLvXxFIyQRY/contest-do-you-think-android-ice-cream.html" title="Contest: Do you think Android Ice Cream Sandwich will beat Apple iOS 5" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>24</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/10/contest-do-you-think-android-ice-cream.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMBQ308fyp7ImA9WhdVE04.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-7643272032207497844</id><published>2011-09-18T11:34:00.000+02:00</published><updated>2011-09-18T11:34:12.377+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-18T11:34:12.377+02:00</app:edited><title>Symbyo Technologies: Cloud Computing and Mobile Application Development</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/q7hR1YMyWm7yyWUjnvGKaSEVAeQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q7hR1YMyWm7yyWUjnvGKaSEVAeQ/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/q7hR1YMyWm7yyWUjnvGKaSEVAeQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q7hR1YMyWm7yyWUjnvGKaSEVAeQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://blog.symbyo.com/2011/09/cloud-computing-and-mobile-application.html"&gt;Symbyo Technologies: Cloud Computing and Mobile Application Development&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-7643272032207497844?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/I60cpGEY_lI" height="1" width="1"/&gt;</content><link rel="related" href="http://blog.symbyo.com/2011/09/cloud-computing-and-mobile-application.html" title="Symbyo Technologies: Cloud Computing and Mobile Application Development" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/7643272032207497844/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/09/symbyo-technologies-cloud-computing-and.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7643272032207497844?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7643272032207497844?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/I60cpGEY_lI/symbyo-technologies-cloud-computing-and.html" title="Symbyo Technologies: Cloud Computing and Mobile Application Development" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/09/symbyo-technologies-cloud-computing-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQDRX09eip7ImA9WhdXEEQ.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-1642299714580899226</id><published>2011-08-23T12:46:00.000+02:00</published><updated>2011-08-23T12:46:14.362+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-23T12:46:14.362+02:00</app:edited><title>Android Developers Blog: Preview of Google TV Add-on for the Android SDK</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MxxEOE57hNgmuCLL8sJaVsxWr6I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MxxEOE57hNgmuCLL8sJaVsxWr6I/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/MxxEOE57hNgmuCLL8sJaVsxWr6I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MxxEOE57hNgmuCLL8sJaVsxWr6I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://android-developers.blogspot.com/2011/08/preview-of-google-tv-add-on-for-android.html?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+blogspot%2FhsDu+%28Android+Developers+Blog%29"&gt;Android Developers Blog: Preview of Google TV Add-on for the Android SDK&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-1642299714580899226?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/JwtvqybdsJE" height="1" width="1"/&gt;</content><link rel="related" href="http://android-developers.blogspot.com/2011/08/preview-of-google-tv-add-on-for-android.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+blogspot%2FhsDu+%28Android+Developers+Blog%29" title="Android Developers Blog: Preview of Google TV Add-on for the Android SDK" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/1642299714580899226/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/08/android-developers-blog-preview-of.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1642299714580899226?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1642299714580899226?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/JwtvqybdsJE/android-developers-blog-preview-of.html" title="Android Developers Blog: Preview of Google TV Add-on for the Android SDK" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/08/android-developers-blog-preview-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8NR3k8eCp7ImA9WhdQFE0.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-536910446600987180</id><published>2011-08-15T13:48:00.000+02:00</published><updated>2011-08-15T13:48:16.770+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-15T13:48:16.770+02:00</app:edited><title>Official Google Blog: Supercharging Android: Google to Acquire Motorola Mobility</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GutDry_3t2iv149QOIq2-qQv5Tk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GutDry_3t2iv149QOIq2-qQv5Tk/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/GutDry_3t2iv149QOIq2-qQv5Tk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GutDry_3t2iv149QOIq2-qQv5Tk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://googleblog.blogspot.com/2011/08/supercharging-android-google-to-acquire.html"&gt;Official Google Blog: Supercharging Android: Google to Acquire Motorola Mobility&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-536910446600987180?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/wT_MfS0WE7E" height="1" width="1"/&gt;</content><link rel="related" href="http://googleblog.blogspot.com/2011/08/supercharging-android-google-to-acquire.html" title="Official Google Blog: Supercharging Android: Google to Acquire Motorola Mobility" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/536910446600987180/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/08/official-google-blog-supercharging.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/536910446600987180?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/536910446600987180?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/wT_MfS0WE7E/official-google-blog-supercharging.html" title="Official Google Blog: Supercharging Android: Google to Acquire Motorola Mobility" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/08/official-google-blog-supercharging.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkABRXc-fip7ImA9WhdRF0Q.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-6382680493710322396</id><published>2011-08-08T11:12:00.000+02:00</published><updated>2011-08-08T11:12:34.956+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-08T11:12:34.956+02:00</app:edited><title>Android Developing: Remove Auto focus from Edit Text</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7vQKDJDxsm2NuK6Ip2Ee1KphEec/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7vQKDJDxsm2NuK6Ip2Ee1KphEec/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/7vQKDJDxsm2NuK6Ip2Ee1KphEec/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7vQKDJDxsm2NuK6Ip2Ee1KphEec/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://android-developing.blogspot.com/2011/02/remove-auto-focus-from-edit-text.html?spref=bl"&gt;Android Developing: Remove Auto focus from Edit Text&lt;/a&gt;: "When start Android application, it always auto focus EditText box. Here we give explain how to remove auto focus from EditText.   Add your..."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-6382680493710322396?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/u3pggPL8dOg" height="1" width="1"/&gt;</content><link rel="related" href="http://android-developing.blogspot.com/2011/02/remove-auto-focus-from-edit-text.html?spref=bl" title="Android Developing: Remove Auto focus from Edit Text" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/6382680493710322396/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/08/android-developing-remove-auto-focus.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/6382680493710322396?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/6382680493710322396?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/u3pggPL8dOg/android-developing-remove-auto-focus.html" title="Android Developing: Remove Auto focus from Edit Text" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/08/android-developing-remove-auto-focus.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EAQXg8eyp7ImA9WhdRFk8.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-1759065050221786084</id><published>2011-08-06T12:14:00.002+02:00</published><updated>2011-08-06T12:14:00.673+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-06T12:14:00.673+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Search" /><title>Implementing Search activities</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xPtrVUUaaCRPw-e4pkkxi6i3qXc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xPtrVUUaaCRPw-e4pkkxi6i3qXc/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/xPtrVUUaaCRPw-e4pkkxi6i3qXc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xPtrVUUaaCRPw-e4pkkxi6i3qXc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Most Android phones have a&lt;strong&gt; search&lt;/strong&gt; button. this button is used to search contacts,applications or anything on the phone. We can make use of the search functionality in our apps.&lt;br /&gt;
&lt;br /&gt;
In this post we're going to see how to implement search functionality to search for entries stored in a databaseand display them in a ListView.&lt;/div&gt;&lt;div closure_uid_ghg7ej="237"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_ghg7ej="237"&gt;&lt;span style="font-size: large;"&gt;Creating database:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;our database has two tables: &lt;strong&gt;Countries&lt;/strong&gt; and &lt;strong&gt;Names:&lt;/strong&gt;&lt;br /&gt;
&lt;pre class="brush:java" closure_uid_ghg7ej="312"&gt;public class DBHelper extends SQLiteOpenHelper {

 public DBHelper(Context context) {
  super(context, "DemoDB", null, 1);
 }

 @Override
 public void onCreate(SQLiteDatabase db) {
  StringBuilder builder=new StringBuilder();
  // countries table
  builder.append("CREATE TABLE Countries ");
  builder.append("(_id INTEGER PRIMARY KEY AUTOINCREMENT,");
  builder.append("NAME TEXT) ");
  db.execSQL(builder.toString());
  // Names table
  // Virtual table for full text search
  builder.setLength(0);
  builder.append("CREATE VIRTUAL TABLE NAMES USING FTS3");
  builder.append("(");
  builder.append("name TEXT) ");  
  db.execSQL(builder.toString());
  builder=new StringBuilder();

  //dummy  data
  InsertData(db);

 }

  void InsertData(SQLiteDatabase db)
  {
   ContentValues cv=new ContentValues();
   cv.put("NAME","USA");
   db.insert("Countries", "NAME", cv);
   cv.put("NAME","UK");
   db.insert("Countries", "NAME", cv);
   cv.put("NAME","Spain");
   db.insert("Countries", "NAME", cv);
   cv.put("NAME","ITALY");
   db.insert("Countries", "NAME", cv);
   cv.put("NAME","Germany");
   db.insert("Countries", "NAME", cv);

    cv=new ContentValues();
    cv.put("name","John");
    db.insert("NAMES", "name", cv);
    cv.put("name","Jack");
    db.insert("NAMES", "name", cv);
    cv.put("name","Ann");
    db.insert("NAMES", "name", cv);
    cv.put("name","Adam");
    db.insert("NAMES", "name", cv);
    cv.put("name","Sarah");
    db.insert("NAMES", "name", cv);

  }

 @Override
 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  // TODO Auto-generated method stub

 }
}&lt;/pre&gt;&lt;/div&gt;notice that the &lt;strong&gt;Names &lt;/strong&gt;table is a &lt;strong&gt;VIRTUAL &lt;/strong&gt;table. we created it as virtual to make use of &lt;strong&gt;Full Text Search (FTS3)&lt;/strong&gt; feature in SQLite. this feature makes queries faster than that in regular tables.&lt;/div&gt;then we add two functions to retrieve all rows from both tables:&lt;br /&gt;
&lt;pre class="brush:java"&gt;/**
  * Return all countries
  * @return
  */
 public ArrayListgetCountries(){
  ArrayList countries=new ArrayList();
  SQLiteDatabase db=this.getReadableDatabase();
  Cursor c=db.rawQuery("select * from Countries", null);
  while(c.moveToNext()){
   String country=c.getString(1);
   countries.add(country);
  }
  c.close();
  return countries;
 }
/**
  * Return all names
  * @return
  */

 public ArrayListgetNames(){
  ArrayList names=new ArrayList();
  Cursor c=this.getReadableDatabase().rawQuery("select * FROM Names", null);
  while(c.moveToNext()){
   String name=c.getString(0);
   names.add(name);
  }
  c.close();
  return names;
 }&lt;/pre&gt;&lt;/div&gt;and another two functions to retrieve data based on a &lt;strong&gt;search string&lt;/strong&gt;:&lt;br /&gt;
&lt;pre class="brush:java"&gt;/**
  * Return all countries based on a search string
  * @return
  */
 public ArrayListgetCountriesSearch(String query){
  ArrayList countries=new ArrayList();
  SQLiteDatabase db=this.getReadableDatabase();
  Cursor c=db.rawQuery("select * from Countries where NAME LIKE '%"+query+"%'", null);
  while(c.moveToNext()){
   String country=c.getString(1);
   countries.add(country);
  }
  c.close();
  return countries;
 }
/**
  * Return all names based on a search string
  * we use the MATCH keyword to make use of the full text search
  * @return
  */
 public ArrayListgetNamesSearch(String query){
  ArrayList names=new ArrayList();
  Cursor c=this.getReadableDatabase().rawQuery("select * FROM Names WHERE name MATCH '"+query+"'", null);
  while(c.moveToNext()){
   String name=c.getString(0);
   names.add(name);
  }
  c.close();
  return names;
 }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Implementing The activity:&lt;/span&gt;&lt;/div&gt;then we will create our activity that has a list view like this:&lt;br /&gt;
&lt;pre class="brush:xml" closure_uid_ghg7ej="313" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&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"
    &amp;gt;
&amp;lt;ListView
android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/list"/&amp;gt;
&amp;lt;/LinearLayout&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;div closure_uid_ghg7ej="251" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/Search%20Activity/search.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320px" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/Search%20Activity/search.bmp" t$="true" width="213px" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;we load data from database like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        list=(ListView)findViewById(R.id.list);

            DBHelper helper=new DBHelper(this);
            ArrayList items=helper.getNames();
            ArrayAdapter adapter=new ArrayAdapter(this, android.R.layout.simple_list_item_1,items);
            list.setAdapter(adapter);
}&lt;/pre&gt;&lt;/div&gt;&lt;div closure_uid_ghg7ej="315"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_ghg7ej="315"&gt;&lt;span style="font-size: large;"&gt;Handling the search dialog:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;In order to handle the search dialog ourselves we need to create a xml file with search configurations such as the search dialog title, voice search capabilities, content provider for auto complete and so on. we create a file with the name &lt;strong&gt;searchable.xml&lt;/strong&gt; in &lt;strong&gt;res/xml&lt;/strong&gt;directory:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/app_name"
    android:hint="@string/hint"  &amp;gt;
&amp;lt;/searchable&amp;gt;&lt;/pre&gt;&lt;/div&gt;the &lt;strong&gt;android:hint&lt;/strong&gt; attribute denotes a string that acts as a water mark on the search text box.&lt;br /&gt;
then we need to add an &lt;strong&gt;Intent Filter&lt;/strong&gt; in out app's &lt;strong&gt;AndroidManifest.xml&lt;/strong&gt; file to our activity to handle the search dialog:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;activity android:name=".MainActivty"
                  android:label="@string/app_name"&amp;gt;
            &amp;lt;intent-filter&amp;gt;
                &amp;lt;action android:name="android.intent.action.MAIN" /&amp;gt;
                &amp;lt;category android:name="android.intent.category.LAUNCHER" /&amp;gt;
            &amp;lt;/intent-filter&amp;gt;
             &amp;lt;intent-filter&amp;gt;
            &amp;lt;action android:name="android.intent.action.SEARCH" /&amp;gt;
        &amp;lt;/intent-filter&amp;gt;
        &amp;lt;meta-data android:name="android.app.searchable"
                   android:resource="@xml/searchable"/&amp;gt;
        &amp;lt;/activity&amp;gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_ghg7ej="317"&gt;&lt;span style="font-size: large;"&gt;Understanding the Search process:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
when you press the search button, type some text and click on search the activit's &lt;strong&gt;onSearchRequested()&lt;/strong&gt; function is called, then an Intent with the action &lt;strong&gt;Intent.ACTION_SEARCH&lt;/strong&gt; is created and you activity is re-created with this intent.&lt;br /&gt;
&lt;br /&gt;
the search intent has you search string as a string extra with the name &lt;strong&gt;SearchManager.QUERY&lt;/strong&gt;. also it can carry a &lt;strong&gt;bundle &lt;/strong&gt;of other extras with the name &lt;strong&gt;SearchManager.APP_DATA&lt;/strong&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;what if the device doesn't have a Search button:&lt;/span&gt;&lt;/div&gt;not all Android devices have a search button, so we can start the search dialog manually by calling the activity's &lt;strong&gt;onSearchRequested()&lt;/strong&gt; from a button or a menu item:&lt;br /&gt;
&lt;pre class="brush:java"&gt;@Override
     public boolean onCreateOptionsMenu(Menu menu) {
     menu.add("Search").setOnMenuItemClickListener(new OnMenuItemClickListener() {

   @Override
   public boolean onMenuItemClick(MenuItem item) {
                                //launch the search dialog
    onSearchRequested();
    return true;
   }
  });
     return true;
    }&lt;/pre&gt;&lt;/div&gt;&lt;div closure_uid_ghg7ej="322"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_ghg7ej="322"&gt;&lt;span style="font-size: large;"&gt;Adding extras to the search dialog:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;we can pass some extra data as a bundle with our search dialog or an initial search string by overriding the activity's &lt;strong&gt;onSearchRequested()&lt;/strong&gt;:&lt;br /&gt;
&lt;pre class="brush:java"&gt;@Override
    public boolean onSearchRequested() {
     Bundle bundle=new Bundle();
  bundle.putString("extra", "exttra info");
  // search initial query
  startSearch("Country", false, bundle, false);
  return true;
    }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Handling the search query:&lt;/span&gt;&lt;/div&gt;&lt;div closure_uid_ghg7ej="324"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_ghg7ej="324"&gt;we said before that the search query is passed as a &lt;strong&gt;String extra&lt;/strong&gt; when our activity is re-created. so we can handle the searcgh string in our &lt;strong&gt;onCreate()&lt;/strong&gt; like this:&lt;/div&gt;&lt;pre class="brush:java" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        list=(ListView)findViewById(R.id.list);

        DBHelper helper=new DBHelper(this);
        Intent intent=getIntent();
        // if the activity is created from search
         if(intent.getAction().equals(Intent.ACTION_SEARCH)){
          // get search query
          String query=intent.getStringExtra(SearchManager.QUERY);
          ArrayList items=helper.getNamesSearch(query);
          //get extras, just for demonstration
          Bundle bundle=intent.getBundleExtra(SearchManager.APP_DATA);
             String info=bundle.getString("extra");
          Log.v("extra", info);
          //bind the list
                ArrayAdapter adapter=new ArrayAdapter(this, android.R.layout.simple_list_item_1,items);
                list.setAdapter(adapter);
         }
        //activity created normally
        else{
         ArrayList items=helper.getNames();
            ArrayAdapter adapter=new ArrayAdapter(this, android.R.layout.simple_list_item_1,items);
            list.setAdapter(adapter);
        }
        helper.close();
    }&lt;/pre&gt;&lt;/div&gt;&lt;div closure_uid_ghg7ej="368" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/Search%20Activity/search2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320px" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/Search%20Activity/search2.bmp" t$="true" width="213px" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
we just extract the search string and any other extras and perform our search logic based on the search string.&lt;br /&gt;
and that's was all about implementing search&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-1759065050221786084?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/OcAlxHm2EEw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/1759065050221786084/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/08/implementing-search-activities.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1759065050221786084?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1759065050221786084?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/OcAlxHm2EEw/implementing-search-activities.html" title="Implementing Search activities" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/08/implementing-search-activities.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UASXk9eip7ImA9WhdRFU4.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-5265609928020930542</id><published>2011-08-05T12:14:00.000+02:00</published><updated>2011-08-05T12:14:08.762+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-05T12:14:08.762+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Service" /><category scheme="http://www.blogger.com/atom/ns#" term="AIDL" /><category scheme="http://www.blogger.com/atom/ns#" term="Remote Service" /><title /><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CMHu6hNoPuK_6NvyjgIrdMaBxeY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CMHu6hNoPuK_6NvyjgIrdMaBxeY/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/CMHu6hNoPuK_6NvyjgIrdMaBxeY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CMHu6hNoPuK_6NvyjgIrdMaBxeY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;In this post we will see how can a client application call the methods of a service defined in another application. this is achieved through &lt;strong&gt;Android Interface Definition Language (AIDL). &lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;AIDL is a java like language that enables you to define an interface that both the application defining the service and the client application implement it.&lt;br /&gt;
&lt;br /&gt;
&lt;div closure_uid_siyhg3="239"&gt;&lt;div closure_uid_siyhg3="260"&gt;the interface defines the functions that are needed to be called in the client application.&lt;/div&gt;&lt;/div&gt;&lt;div closure_uid_siyhg3="232"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_siyhg3="232"&gt;&lt;span style="font-size: large;"&gt;Defining the AIDL file:&lt;/span&gt;&lt;/div&gt;AIDL syntax is similar to that of Java, we can use the following data types in AIDL:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;primitive data types:&amp;nbsp;int, long, char, boolean,....&lt;/li&gt;
&lt;li&gt;String.&lt;/li&gt;
&lt;li&gt;CharSequence.&lt;/li&gt;
&lt;li&gt;List (ArrayList,Vector,...).&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;the AIDL file is defined as follows:&lt;br /&gt;
open a notepad file and paste the following code in it:&lt;br /&gt;
&lt;pre class="brush:java"&gt;package com.mina.servicedemo;

// service interface
interface IRemoteService {
    //sample method
    String sayHello(String message);
}&lt;/pre&gt;take care of the package name &lt;strong&gt;com.mina.servicedemo&lt;/strong&gt;.&lt;br /&gt;
we defined a methods &lt;strong&gt;sayHello(String message)&lt;/strong&gt; that returns a string.&lt;/li&gt;
&lt;li&gt;save the file with the name&lt;strong&gt; IRemoteService&lt;/strong&gt; and change it's extension to &lt;strong&gt;.aidl&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;copy the file to the &lt;strong&gt;src&lt;/strong&gt; folder of your project.&lt;/li&gt;
&lt;li&gt;once you save and build the file, Android generates an interface java file with the name&amp;nbsp;&lt;strong&gt;IRemoteService.java&lt;/strong&gt;&amp;nbsp;in the&amp;nbsp;&lt;strong&gt;gen&lt;/strong&gt;&amp;nbsp;folder if the project.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_siyhg3="243"&gt;&lt;span style="font-size: large;"&gt;Defining the Service:&lt;/span&gt;&lt;/div&gt;now we want our service to expose this interface to client applications, so we return an&amp;nbsp;implementation of the service in the &lt;strong&gt;onBind()&lt;/strong&gt; method of our service:&lt;br /&gt;
&lt;pre class="brush:java"&gt;package com.mina.servicedemo;

import com.mina.servicedemo.IRemoteService.Stub;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.widget.Toast;

public class DemoService extends Service {

 @Override
 public IBinder onBind(Intent arg0) {
  return mBinder;
 }

 // implementation of the aidl interface
 private final IRemoteService.Stub mBinder=new Stub() {

  @Override
  public String sayHello(String message) throws RemoteException {
   return "Hello "+message;

  }
 };

 }
}&lt;/pre&gt;&lt;/div&gt;the last thing to do in the service is to make its &lt;strong&gt;exported&lt;/strong&gt; attribute in the &lt;strong&gt;AndroidManifest.xml&lt;/strong&gt; file set to true like this:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;service android:name="DemoService" android:exported="true"&amp;gt;&amp;lt;/service&amp;gt;&lt;/pre&gt;our app structure can be like this:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/AIDL/aidl.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/AIDL/aidl.bmp" t$="true" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div closure_uid_siyhg3="248"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div closure_uid_siyhg3="259"&gt;&lt;span style="font-size: large;"&gt;Consuming the service at the client application:&lt;/span&gt;&lt;/div&gt;now to our client application where we want to invoke methods from our service. the client application is a separate application with a different package name than that where the service is defined.&lt;br /&gt;
&lt;br /&gt;
the client application needs a reference to the AIDL interface defined in the original applcation, this is done through the following steps:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;in the client applicatio create a package with the same package name of that the service is defined in: &lt;strong&gt;com.mina.servicedemo.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;copy the AIDL file in this package.&lt;/li&gt;
&lt;li closure_uid_siyhg3="261" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;save and build and a new file called IRemoteService.java is generated. your app structure should be like this: &lt;/li&gt;
&lt;/ol&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/AIDL/aidl2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/August/AIDL/aidl2.bmp" t$="true" /&gt;&lt;/a&gt;&lt;/div&gt;and we invoke the servcice methods in our activity like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;package com.mina.serviceclient;

import com.mina.servicedemo.IRemoteService;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class MainActivity extends Activity {

 IRemoteService mRemoteService;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Intent serviceIntent=new Intent();
        serviceIntent.setClassName("com.mina.servicedemo", "com.mina.servicedemo.DemoService");
        boolean ok=bindService(serviceIntent, mServiceConnection,Context.BIND_AUTO_CREATE);
        Log.v("ok", String.valueOf(ok));
    }

    private ServiceConnection mServiceConnection=new ServiceConnection() {

  @Override
  public void onServiceDisconnected(ComponentName name) {
   // TODO Auto-generated method stub

  }

  @Override
  public void onServiceConnected(ComponentName name, IBinder service) {
   // get instance of the aidl binder
   mRemoteService = IRemoteService.Stub.asInterface(service);
   try {
    String message=mRemoteService.sayHello("Mina");
    Log.v("message", message);
   } catch (RemoteException e) {
    Log.e("RemoteException", e.toString());
   }

  }
 };
}&lt;/pre&gt;&lt;/div&gt;and that's was all about calling remote services with AIDL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-5265609928020930542?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/U6jlOc_ydL4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/5265609928020930542/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/08/in-this-post-we-will-see-how-can-client.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/5265609928020930542?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/5265609928020930542?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/U6jlOc_ydL4/in-this-post-we-will-see-how-can-client.html" title="" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/08/in-this-post-we-will-see-how-can-client.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYESX85eip7ImA9WhdRFE0.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-3923827596657274241</id><published>2011-08-03T23:48:00.000+02:00</published><updated>2011-08-03T23:48:28.122+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-03T23:48:28.122+02:00</app:edited><title>Official Google Blog: When patents attack Android</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5nbGs820EnoyQqIWWeeJUM5B-hE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5nbGs820EnoyQqIWWeeJUM5B-hE/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/5nbGs820EnoyQqIWWeeJUM5B-hE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5nbGs820EnoyQqIWWeeJUM5B-hE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://googleblog.blogspot.com/2011/08/when-patents-attack-android.html?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+blogspot%2FMKuf+%28Official+Google+Blog%29"&gt;Official Google Blog: When patents attack Android&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-3923827596657274241?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/OS2qgccqnS4" height="1" width="1"/&gt;</content><link rel="related" href="http://googleblog.blogspot.com/2011/08/when-patents-attack-android.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+blogspot%2FMKuf+%28Official+Google+Blog%29" title="Official Google Blog: When patents attack Android" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/3923827596657274241/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/08/official-google-blog-when-patents.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3923827596657274241?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3923827596657274241?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/OS2qgccqnS4/official-google-blog-when-patents.html" title="Official Google Blog: When patents attack Android" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/08/official-google-blog-when-patents.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMARng6fip7ImA9WhdSGEk.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-5865612228744179770</id><published>2011-07-28T10:40:00.000+02:00</published><updated>2011-07-28T10:40:47.616+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-28T10:40:47.616+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Android Story: From [x] cube Labs</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Cc5zZr_T4vDRq4lbT1KDjiiN8tA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Cc5zZr_T4vDRq4lbT1KDjiiN8tA/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/Cc5zZr_T4vDRq4lbT1KDjiiN8tA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Cc5zZr_T4vDRq4lbT1KDjiiN8tA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;a href="http://www.xcubelabs.com/the-android-story.php"&gt;&lt;img alt="The-Andriod-Story" border="0" src="http://www.xcubelabs.com/images/android-infograph.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Infographic by &lt;a href="http://www.xcubelabs.com/"&gt;Android Developers at [x]cubelabs&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/3614313680693372993-5865612228744179770?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/qYeyJOJtFfM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/5865612228744179770/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/07/android-story-from-x-cube-labs.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/5865612228744179770?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/5865612228744179770?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/qYeyJOJtFfM/android-story-from-x-cube-labs.html" title="Android Story: From [x] cube Labs" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/07/android-story-from-x-cube-labs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MNR3czfip7ImA9WhdTGU8.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-5314929159235970351</id><published>2011-07-17T18:51:00.000+02:00</published><updated>2011-07-17T18:51:36.986+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-17T18:51:36.986+02:00</app:edited><title>Symbyo Technologies: The Android Invasion Continues!!</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rNbUGmjA_0BZDr6N1h-ozD9OBes/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rNbUGmjA_0BZDr6N1h-ozD9OBes/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/rNbUGmjA_0BZDr6N1h-ozD9OBes/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rNbUGmjA_0BZDr6N1h-ozD9OBes/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://blog.symbyo.com/2011/07/android-invasion-continues.html"&gt;Symbyo Technologies: The Android Invasion Continues!!&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-5314929159235970351?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/TQd8gQXJhWI" height="1" width="1"/&gt;</content><link rel="related" href="http://blog.symbyo.com/2011/07/android-invasion-continues.html" title="Symbyo Technologies: The Android Invasion Continues!!" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/5314929159235970351/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/07/symbyo-technologies-android-invasion.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/5314929159235970351?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/5314929159235970351?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/TQd8gQXJhWI/symbyo-technologies-android-invasion.html" title="Symbyo Technologies: The Android Invasion Continues!!" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/07/symbyo-technologies-android-invasion.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEIGQXo9eip7ImA9WhZaGEU.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-3887391238569901115</id><published>2011-07-05T19:22:00.003+02:00</published><updated>2011-07-05T19:22:00.462+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-05T19:22:00.462+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Service" /><title>Android Services</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9YguOPotKB3eGMIYujR3pk-5PK0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9YguOPotKB3eGMIYujR3pk-5PK0/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/9YguOPotKB3eGMIYujR3pk-5PK0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9YguOPotKB3eGMIYujR3pk-5PK0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;strong&gt;Android Service &lt;/strong&gt;is used for long-running processes that do not require user interaction, such as calling a web service and parsing response. Or processes that need to be running even if the application that started the service is not on the foreground such as playing mp3 files in a music player.&lt;br /&gt;
&lt;br /&gt;
we need to distinguish between A &lt;strong&gt;Service&lt;/strong&gt; and a&lt;strong&gt; Thread&lt;/strong&gt; or an &lt;strong&gt;AsyncTask: &lt;/strong&gt;Threads or Async task perform their tasks in a background thread thus they do not block the main thread, while a service performs it's work in the main thread. so if a service is performing an intensive task such as calling a web service, it may block the main thread until it finishes. So for intensive tasks a service should run it's work in a background thread.&lt;br /&gt;
&lt;br /&gt;
A service runs in the same process of the application and keeps running until stopped by itself, stopped by the user or killed by the system if it needs memory.&lt;br /&gt;
&lt;h2&gt;Creating a service:&lt;/h2&gt;to create a service we create a class that extends&amp;nbsp;&lt;strong&gt;android.app.Service &lt;/strong&gt;and it would be like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public class DemoService extends Service {

 @Override
 public IBinder onBind(Intent arg0) {
  // TODO Auto-generated method stub
  return null;
 }

}&lt;/pre&gt;next we need to define our service in our &lt;strong&gt;AndroidManifest.xml&lt;/strong&gt; file:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;service android:name="DemoService"&amp;gt;&amp;lt;/service&amp;gt;&lt;/pre&gt;The service life cycle has the following events&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;onCreate():&lt;/strong&gt; called when the service is created.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;onStart():&lt;/strong&gt; Called when the service starts by a call to &lt;strong&gt;startService(Intent intent)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;onDestroy():&lt;/strong&gt; Called as the service is terminates.&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;&lt;strong&gt;Calling a service:&lt;/strong&gt;&lt;/h2&gt;A service can be called from an activity in two ways:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;By calling&amp;nbsp;&lt;strong&gt;startService(Intent intent).&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;By binding to the service through an &lt;strong&gt;Binder&lt;/strong&gt; object.&lt;/li&gt;
&lt;/ol&gt;&lt;h3&gt;calling&amp;nbsp;startService(Intent intent):&lt;/h3&gt;to start a service from an activity using this method, we create an intent and start the service like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;Intent intent=new Intent(this,DemoService.class);
startService(intent);&lt;/pre&gt;the &lt;strong&gt;startService(intent)&lt;/strong&gt; method causes the onStart() method of the service to be called, so the service can execute it's work like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public class DemoService extends Service {

 @Override
 public IBinder onBind(Intent arg0) {
  // TODO Auto-generated method stub
  return null;
 }

 @Override
 public void onStart(Intent intent, int startId) {
  super.onStart(intent, startId);
  doSomething();
 }

 public void doSomething(){
  // do some work
 }

}&lt;/pre&gt;the service will keep running until it stops itself via stop &lt;strong&gt;stopSelf()&lt;/strong&gt; after finishing work:&lt;br /&gt;
&lt;pre class="brush:java"&gt;@Override
 public void onStart(Intent intent, int startId) {
  super.onStart(intent, startId);
  doSomething();
  stopSelf();
 }&lt;/pre&gt;or it can be stopped from the activity via &lt;strong&gt;stopService(Intent intent)&lt;/strong&gt;.&lt;br /&gt;
&lt;h3&gt;Binding to a service through an Binder object:&lt;/h3&gt;As the service runs in the same process of the application the service has only one instance (singleton) instance running. you may want to keep reference to this instance to perform periodical tasks or to call the service methods themselves.&lt;br /&gt;
&lt;br /&gt;
to make the service&amp;nbsp;bind-able we extends&amp;nbsp;&lt;strong&gt;Binder&lt;/strong&gt; class&amp;nbsp;and return an instance of it in the service's &lt;strong&gt;onBind(Intent intent)&lt;/strong&gt; method:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public class DemoService extends Service {

 private final IBinder binder = new LocalBinder();
 @Override
 public IBinder onBind(Intent arg0) {
  return binder;
 }

 public class LocalBinder extends Binder {
  DemoService getService() {
            return DemoService.this;
        }
    }

 @Override
 public void onStart(Intent intent, int startId) {
  super.onStart(intent, startId);
  doSomething();
  stopSelf();
 }

 public void doSomething(){
  // do something
 }

}&lt;/pre&gt;then we bind the service from our activity by first creating a ServiceConnection object to handle the service connection/disconnection then binding to the service by an intent like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public class MainActivity extends Activity {

 DemoService mService;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    ServiceConnection serviceConn=new ServiceConnection() {

                /**
                * service unbound, release from memory
                **/
  @Override
  public void onServiceDisconnected(ComponentName name) {
   mService=null;
  }

                /**
                * service is bound, start it's work
                **/
  @Override
  public void onServiceConnected(ComponentName name, IBinder service) {
   mService=((LocalBinder)service).getService();
   mService.doSomething();

  }
 };

    @Override
    protected void onResume() {
     super.onResume();
        // bind to the service by an intent
     Intent intent=new Intent(this,DemoService.class);
        // AUTO CREATE: creates the service and gives it an importance so that it won't be killed
        // unless any process bound to it (our activity in this case) is killed to
     bindService(intent, serviceConn, Context.BIND_AUTO_CREATE);
    }

    @Override
    protected void onDestroy() {
     super.onDestroy();
        / unbind the service whena ctivity is destroyed
     unbindService(serviceConn);
    }
}&lt;/pre&gt;notice that we &lt;strong&gt;unbind&lt;/strong&gt; the service in the activity's &lt;strong&gt;onDestroy()&lt;/strong&gt; method to disconnect from the service and stop it from executing any further&lt;br /&gt;
&lt;br /&gt;
and that's was all about Android services, stay tuned for another Android tutorial.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-3887391238569901115?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/qwA7lb_IzCc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/3887391238569901115/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/07/android-services.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3887391238569901115?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3887391238569901115?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/qwA7lb_IzCc/android-services.html" title="Android Services" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/07/android-services.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04AQXg7cCp7ImA9WhZaF0Q.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-2054746061157357328</id><published>2011-07-04T19:19:00.005+02:00</published><updated>2011-07-04T19:19:00.608+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-04T19:19:00.608+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JSON" /><category scheme="http://www.blogger.com/atom/ns#" term="Parsing" /><title>Parsing JSON respone:</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iQtlfeYmWwPOjtE-UUqrquoNCIY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iQtlfeYmWwPOjtE-UUqrquoNCIY/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/iQtlfeYmWwPOjtE-UUqrquoNCIY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iQtlfeYmWwPOjtE-UUqrquoNCIY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
&lt;/div&gt;if we have a JSON web service response like this:&lt;br /&gt;
&lt;pre&gt;"persons"
[
{
"person"{
"firstName": "John",
     "lastName": "Smith",
     "age": 25
}
}
{
"person"{
"firstName": "Catherine",
     "lastName": "Jones",
     "age": 35
}
}
]&lt;/pre&gt;this response is a &lt;strong&gt;JSON Array&lt;/strong&gt; with the name "persons", this array consists of "person" &lt;strong&gt;JSON Object&lt;/strong&gt;s.&lt;br /&gt;
to parse such a reponse:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public ArrayList&amp;lt;Person&amp;gt; getMessage(String response){
  JSONObject jsonResponse;
  ArrayList&amp;lt;Person&amp;gt; arrPersons=new ArrayList&amp;lt;Person&amp;gt;;
  try {
   // obtain the reponse
   jsonResponse = new JSONObject(response);
   // get the array
   JSONArray persons=jsonResponse.optJSONArray("persons");
   // iterate over the array and retrieve single person instances
   for(int i=0;i&amp;lt;persons.length();i++){
    // get person object
    JSONObject person=persons.getJSONObject(i);
    // get first name
    String firstname=person.optString("firstname");
    // get last name
    String lastname=person.optString("lastname");
    // get the age
    int age=person.optInt("age");

    // construct the object and add it to the arraylist
    Person p=new Person();
    p.firstName=firstname;
    p.lastName=lastname;
    p.age=age;
    arrPersons.add(p);
   }

  } catch (JSONException e) {

   e.printStackTrace();
  }

  return arrPersons;
 }&lt;/pre&gt;&lt;br /&gt;
notice that we used the methods &lt;strong&gt;optJSONArray,optString,optInt&lt;/strong&gt; instead of using &lt;strong&gt;getString,getInt&lt;/strong&gt; because the opt methods return empty strings or zero integers if no elements are found. while the get methods throw an exception if the element is not found.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-2054746061157357328?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/phZ_8DG5Jts" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/2054746061157357328/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/07/parsing-json-respone.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/2054746061157357328?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/2054746061157357328?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/phZ_8DG5Jts/parsing-json-respone.html" title="Parsing JSON respone:" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/07/parsing-json-respone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcFR3k-eip7ImA9WhZaF0s.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-8902767275687366586</id><published>2011-07-03T19:10:00.006+02:00</published><updated>2011-07-04T10:10:16.752+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-04T10:10:16.752+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="XML" /><category scheme="http://www.blogger.com/atom/ns#" term="Parsing" /><category scheme="http://www.blogger.com/atom/ns#" term="SAX Parser" /><title>Parsing XML wit SAX parser</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MerfCa4Z2lRzDtYslyYrDJxf_a4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MerfCa4Z2lRzDtYslyYrDJxf_a4/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/MerfCa4Z2lRzDtYslyYrDJxf_a4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MerfCa4Z2lRzDtYslyYrDJxf_a4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Android provides &lt;strong&gt;org.xml.sax&lt;/strong&gt; package that has that provides the event-driven SAX parser.&lt;br /&gt;
to parse the previous response with SAX parser, we have to create a class extending &lt;strong&gt;DefaultHandler&lt;/strong&gt; and override the following methods:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;startDocument():&lt;/strong&gt; invoked when the xml document is open, there we can initialize any member variables.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;startElement(String uri, String localName, String qName,    Attributes attributes):&lt;/strong&gt; invoked when the parser encounters a xml node, here we can initialize specific instances of our person object.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;endElement(String uri, String localName, String Name):&lt;/strong&gt; invoked when the parser reaches the closing of a xml tag. here the element value would have been completely read.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;characters(char[] ch, int start, int length):&lt;/strong&gt; this method is called when the parser reads characters of a node value.&lt;/li&gt;
&lt;/ol&gt;we want to parse this xml response:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;person&amp;gt;
    &amp;lt;firstname&amp;gt;Jack&amp;lt;/firstname&amp;gt;
    &amp;lt;lastname&amp;gt;smith&amp;lt;/lastname&amp;gt;
    &amp;lt;age&amp;gt;28&amp;lt;/age&amp;gt;
&amp;lt;/person&amp;gt;&lt;/pre&gt;so our parsing class will be like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;/**
  * SAX parser to parse persons response
  */
 public class PersonParser extends DefaultHandler
 {

  // arraylist to store person objects
  ArrayList persons;
  // temporary person object
  Person tempPerson;
  // string builder acts as a buffer
  StringBuilder builder;

  /**
   * Initialize the arraylist
   * @throws SAXException
   */
  @Override
  public void startDocument() throws SAXException {
   pesons=new ArrayList();

  }

  /**
   * Initialize the temp person object which will hold the parsed in//fo
   * and the string builder that will store the read characters
   * @param uri
   * @param localName
   * @param qName
   * @param attributes
   * @throws SAXException
   */
  @Override
  public void startElement(String uri, String localName, String qName,
    Attributes attributes) throws SAXException {

   if(localName.equalsIgnoreCase.equals("person")){
    tempPerson=new Person();
    builder=new StringBuilder();
   }

  }
  /**
   * Finished reading the person tag, add it to arraylist
   * @param uri
   * @param localName
   * @param qName
   * @throws SAXException
   */
  @Override
  public void endElement(String uri, String localName, String qName)
    throws SAXException {
   // finished reading a person, add it to the arraylist
   if(localName.toLowerCase().equals("person"))
   {
    this.persons.add(tempPerson);
   }
   // finished reading "firstname" tag assign it to the temp person
   else if(localName.toLowerCase().equals("firstname")){
    tempPerson.firstName=builder.toString();
   }
   // finished reading "lastname" tag assign it to the temp person
   else if(localName.toLowerCase().equals("lastname")){
    tempPerson.lastName=builder.toString();
   }
   // finished reading "age" tag assign it to the temp person
   else if(localName.toLowerCase().equals("age")){
    tempPerson.age=Integer.parseInt(builder.toString());
   }
  }

  /**
   * Read the value of each tag
   * @param ch
   * @param start
   * @param length
   * @throws SAXException
   */
  @Override
  public void characters(char[] ch, int start, int length)
    throws SAXException {
   // read the characters and append them to the buffer
   String tempString=new String(ch, start, length);
    builder.append(tempString);
  }
 }&lt;/pre&gt;the code is pretty easy, the parser iterates over each node, you check the current node name and take an action.&lt;br /&gt;
&lt;br /&gt;
then we call the parser like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public ArrayList getPersons(final String response) throws ParserConfigurationException, SAXException, IOException
 {
  BufferedReader br=new BufferedReader(new StringReader(response));
  InputSource is=new InputSource(br);
  PersonParser parser=new PersonParser();
  SAXParserFactory factory=SAXParserFactory.newInstance();
     SAXParser sp=factory.newSAXParser();
     XMLReader reader=sp.getXMLReader();
     reader.setContentHandler(parser);
     reader.parse(is);
     ArrayList persons=parser.persons;

  return persons;

 }&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-8902767275687366586?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/tV_5E_mvFmw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/8902767275687366586/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/07/parsing-xml-wit-sax-parser.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/8902767275687366586?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/8902767275687366586?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/tV_5E_mvFmw/parsing-xml-wit-sax-parser.html" title="Parsing XML wit SAX parser" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/07/parsing-xml-wit-sax-parser.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQEQXw4eip7ImA9WhZaFk8.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-7128257481131731709</id><published>2011-07-02T19:05:00.001+02:00</published><updated>2011-07-02T19:05:00.232+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-02T19:05:00.232+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="DOM Parser" /><category scheme="http://www.blogger.com/atom/ns#" term="XML" /><category scheme="http://www.blogger.com/atom/ns#" term="Parsing" /><title>Parsing XML wit DOM parser</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/m06v4ZIS0S_04eeO5QdW0y1ZsMs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/m06v4ZIS0S_04eeO5QdW0y1ZsMs/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/m06v4ZIS0S_04eeO5QdW0y1ZsMs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/m06v4ZIS0S_04eeO5QdW0y1ZsMs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
&lt;/div&gt;Android offers three types of XML parsers:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;DOM Parser.&lt;/li&gt;
&lt;li&gt;Pull Parser.&lt;/li&gt;
&lt;li&gt;SAX Parser.&lt;/li&gt;
&lt;/ol&gt;we'll demonstrate each using the following xml example:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;person&amp;gt;
    &amp;lt;firstname&amp;gt;Jack&amp;lt;/firstname&amp;gt;
    &amp;lt;lastname&amp;gt;smith&amp;lt;/lastname&amp;gt;
    &amp;lt;age&amp;gt;28&amp;lt;/age&amp;gt;
&amp;lt;/person&amp;gt;&lt;/pre&gt;which we need to parse to create an object from &lt;strong&gt;Person&lt;/strong&gt; class:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public class Person{
     public String firstName;
     public String lastName;
     public int age;
    }&lt;/pre&gt;&lt;b&gt;Parsing the response with DOM Parser:&lt;/b&gt;&lt;/div&gt;Android provides org.w3c.dom library that contains classes used to parse xml by constructing a document and&lt;br /&gt;
matching each node to parse the info.&lt;br /&gt;
to parse our example response with DOM parser, we implement a function like this&lt;br /&gt;
&lt;pre class="brush:java"&gt;void parseByDOM(String response) throws ParserConfigurationException, SAXException, IOException{
     Person person=new Person();
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     DocumentBuilder db = dbf.newDocumentBuilder();
     Document doc = db.parse(new InputSource(new StringReader(response)));
     // normalize the document
     doc.getDocumentElement().normalize();
     // get the root node
     NodeList nodeList = doc.getElementsByTagName("person");
     Node node=nodeList.item(0);
     // the  node has three child nodes
     for (int i = 0; i &amp;lt; node.getChildNodes().getLength(); i++) {
     Node temp=node.getChildNodes().item(i);
     if(temp.getNodeName().equalsIgnoreCase("firstname")){
      person.firstName=temp.getTextContent();
     }
     else if(temp.getNodeName().equalsIgnoreCase("lastname")){
      person.lastName=temp.getTextContent();
     }
     else if(temp.getNodeName().equalsIgnoreCase("age")){
      person.age=Integer.parseInt(temp.getTextContent());
     }

     }

     Log.e("person", person.firstName+ " "+person.lastName+" "+String.valueOf(person.age));
    }&lt;/pre&gt;The previous method is good, it retrieves the info correctly, but it requires that you are familiar with the xml structure so that you know the order of each xml node.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-7128257481131731709?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/36vcpFK1z9s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/7128257481131731709/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/07/parsing-xml-wit-dom-parser.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7128257481131731709?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7128257481131731709?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/36vcpFK1z9s/parsing-xml-wit-dom-parser.html" title="Parsing XML wit DOM parser" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>4</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/07/parsing-xml-wit-dom-parser.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMHQns-fSp7ImA9WhZbFk0.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-1633048291203814502</id><published>2011-06-20T22:57:00.000+02:00</published><updated>2011-06-20T22:57:13.555+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-20T22:57:13.555+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Applications" /><category scheme="http://www.blogger.com/atom/ns#" term="RapidFire" /><title>RapidFire</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JqQz-WbA5RcIhcMzyFrv1xFTJ7U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JqQz-WbA5RcIhcMzyFrv1xFTJ7U/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/JqQz-WbA5RcIhcMzyFrv1xFTJ7U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JqQz-WbA5RcIhcMzyFrv1xFTJ7U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&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="https://market.android.com/details?id=com.peapple.rapidfire" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="82" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/android_market.png" width="207" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0"&gt;&lt;tbody&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
APPLICATION: &lt;b&gt;RapidFire.&lt;/b&gt;&lt;/td&gt;&lt;td rowspan="6"&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/rapid_fire_small_logo.png" /&gt;&lt;/td&gt;    &lt;td rowspan="6"&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/peaapple.png" /&gt;&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
DEVELOPER: &lt;b&gt;&lt;a href="http://peapple.com/peapple/Peapple.html"&gt;Peapple Ltd&lt;/a&gt;&lt;/b&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
CATEGORY: &lt;b&gt;Social&lt;/b&gt;&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
PRICE: &lt;b&gt;Free.&lt;/b&gt;&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
REQUIRES ANDROID: &lt;b&gt;2.2 and up&lt;/b&gt;&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
CONTENT RATING: &lt;b&gt;Low Maturity&lt;/b&gt;&lt;/td&gt;    &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;With RapidFire share your messages and upload multiple photos to multiple social networks including:&lt;/span&gt;&lt;br /&gt;
&lt;table cellpadding="5"&gt;&lt;tbody&gt;
&lt;tr&gt;    &lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
Facebook&lt;/td&gt;    &lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
Twitter&lt;/td&gt;     &lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
LinkedIn&lt;/td&gt;    &lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
WordPress&lt;/td&gt;    &lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
last.fm&lt;/td&gt;    &lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
My Space&lt;/td&gt;&lt;td style="color: #666666; font-size: 14px; font-weight: bold;"&gt;&lt;br /&gt;
Tumblr&lt;/td&gt;        &lt;/tr&gt;
&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/facebook_logo.png" /&gt;&lt;/td&gt;    &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/twitter_logo.png" /&gt;&lt;/td&gt;    &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/linkedin_logo.png" /&gt;&lt;/td&gt;    &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/wordpress_logo.png" /&gt;&lt;/td&gt;    &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/lastfm_logo.png" /&gt;&lt;/td&gt;    &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/myspace_logo.png" /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;
&lt;img border="0" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/tumblr_logo.png" /&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;now with &lt;b&gt;RapidFire&lt;/b&gt; share your thoughts with the whole world with the whole world with a single click:&lt;/span&gt;&lt;br /&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="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/message_landscape_activity.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="213" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/message_landscape_activity.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;share thoughts in one click&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;just write what you want and &lt;b&gt;Fire...&lt;/b&gt;&lt;br /&gt;
you can send more than 140 characters to all networks including &lt;b&gt;Twitter&lt;/b&gt;.&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Sign in with your account to 11 social networks:&lt;/span&gt;&lt;br /&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="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/networks_activity.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/networks_activity.jpg" width="192" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;RapidFire social networks&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;RapidFire&lt;/b&gt; supports the following networks and blogs:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;Facebook.&lt;/li&gt;
&lt;li&gt;Twitter.&lt;/li&gt;
&lt;li&gt;LinkedIn.&lt;/li&gt;
&lt;li&gt;Tumblr.&lt;/li&gt;
&lt;li&gt;My Space.&lt;/li&gt;
&lt;li&gt;Google Buzz.&lt;/li&gt;
&lt;li&gt;WordPress.&lt;/li&gt;
&lt;li&gt;last. fm.&lt;/li&gt;
&lt;li&gt;Foursquare.&lt;/li&gt;
&lt;li&gt;Friendfeed.&lt;/li&gt;
&lt;li&gt;idetni.ca.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Take photos and include them with your message instantly:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/images_service_activity.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/images_service_activity.png" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;RapidFire&lt;/b&gt;&amp;nbsp;supports the following image services:&lt;/div&gt;&lt;div&gt;&lt;ol style="text-align: left;"&gt;&lt;li&gt;YFrog.&lt;/li&gt;
&lt;li&gt;Mobypicture.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Say what you want even from your home screen:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/rapid_fire_home_screen_widget.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/rapid_fire_home_screen_widget.jpg" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
share your thoughts even from your phone's home screen.&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Upgrade to the Pro version and enjoy more features:&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://market.android.com/details?id=com.peapple.rapidfire.pro" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/rapid_fire_pro_logo.png" width="200" /&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;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Geo-tagging: link your posts with your locations:&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/location_activity.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/location_activity.png" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Ad-free:&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/tumblr_activity.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/Rapid%20Fire/tumblr_activity.jpg" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;And a last word for developers:&lt;/span&gt;&lt;br /&gt;
RapidFire is an excellent example of the application that can wrap many different APIs and provide an easy way to access them seamlessly. in such a case that you have multiple social networks APIs, it's important to isolate the user from the complications of each one through such an abstraction.&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/3614313680693372993-1633048291203814502?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/nR_mcKV_zzs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/1633048291203814502/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/06/rapidfire.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1633048291203814502?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1633048291203814502?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/nR_mcKV_zzs/rapidfire.html" title="RapidFire" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/06/rapidfire.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEASX0zeip7ImA9WhZUFE4.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-9001657805536520719</id><published>2011-06-07T10:50:00.000+02:00</published><updated>2011-06-07T10:50:48.382+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-07T10:50:48.382+02:00</app:edited><title>Android Developers Blog: New Editing Features in Eclipse plug-in for Android</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ugeX5elkd3j95TyoGiKC8fcrcA0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ugeX5elkd3j95TyoGiKC8fcrcA0/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/ugeX5elkd3j95TyoGiKC8fcrcA0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ugeX5elkd3j95TyoGiKC8fcrcA0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://android-developers.blogspot.com/2011/06/new-editing-features-in-eclipse-plug-in.html?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+blogspot%2FhsDu+(Android+Developers+Blog)"&gt;Android Developers Blog: New Editing Features in Eclipse plug-in for Android&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-9001657805536520719?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/oP0a7G6c0rs" height="1" width="1"/&gt;</content><link rel="related" href="http://android-developers.blogspot.com/2011/06/new-editing-features-in-eclipse-plug-in.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+blogspot%2FhsDu+(Android+Developers+Blog)" title="Android Developers Blog: New Editing Features in Eclipse plug-in for Android" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/9001657805536520719/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/06/android-developers-blog-new-editing.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/9001657805536520719?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/9001657805536520719?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/oP0a7G6c0rs/android-developers-blog-new-editing.html" title="Android Developers Blog: New Editing Features in Eclipse plug-in for Android" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/06/android-developers-blog-new-editing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUACQX4_fip7ImA9WhZUEks.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-3297227041035135713</id><published>2011-06-05T11:56:00.001+02:00</published><updated>2011-06-05T11:56:00.046+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-05T11:56:00.046+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSL" /><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="web service" /><title>Connecting to a web service over a Secure Sockets Layer (SSL): protocol:</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zsOPLEY4KxC2zzwI2EMaeWZyqs8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zsOPLEY4KxC2zzwI2EMaeWZyqs8/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/zsOPLEY4KxC2zzwI2EMaeWZyqs8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zsOPLEY4KxC2zzwI2EMaeWZyqs8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Android default &lt;b&gt;HttpClinet&lt;/b&gt; does not support SSL connections, so if you have a secured web service, you need to connect to it via &lt;b&gt;javax.net.ssl.HttpsURLConnection&lt;/b&gt;.&lt;br /&gt;
if you want to call a SSL SOAP web service:&lt;br /&gt;
&lt;pre class="brush:java"&gt;String CallWebService(String url,
    String soapAction,
   String envelope) throws IOException  {
  URL address=new URL(url);
  URLConnection connection=address.openConnection();
  HttpsURLConnection post=(HttpsURLConnection)connection;
  post.setDoInput(true);
  post.setDoOutput(true);
  post.setRequestMethod("POST");
  post.setRequestProperty("SOAPAction", soapAction);
  post.setRequestProperty( "Content-type", "text/xml; charset=utf-8" );
  post.setRequestProperty( "Content-Length", String.valueOf(envelope.length()));
  post.setReadTimeout(4000);
  
  OutputStream outStream=post.getOutputStream();
  Writer out=new OutputStreamWriter(outStream);
  out.write(envelope);
  out.flush();
  out.close();
  
  
  InputStream inStream = post.getInputStream();
  BufferedInputStream in = new BufferedInputStream(inStream,4);
  StringBuffer buffer=new StringBuffer();
  // read 4 bytes a time
  byte[] buffArray=new byte[4];
  int c=0;
   while((c=in.read(buffArray))!=-1){
    for(int i=0;i&amp;lt;c;i++)
     buffer.append((char)buffArray[i]);
   }

   return buffer.toString();
 }
&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-3297227041035135713?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/twJThJqdF68" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/3297227041035135713/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/06/connecting-to-web-service-over-secure.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3297227041035135713?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3297227041035135713?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/twJThJqdF68/connecting-to-web-service-over-secure.html" title="Connecting to a web service over a Secure Sockets Layer (SSL): protocol:" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/06/connecting-to-web-service-over-secure.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEACQX4zcCp7ImA9WhZUEU4.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-7109857722007390671</id><published>2011-06-03T22:26:00.001+02:00</published><updated>2011-06-03T22:26:00.088+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-03T22:26:00.088+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SOAP" /><category scheme="http://www.blogger.com/atom/ns#" term="HTTPClient" /><category scheme="http://www.blogger.com/atom/ns#" term="web service" /><title>Calling SOAP Web Services with Android APIs</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8nabOcclbn6vWb2bI-gfGyereNE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8nabOcclbn6vWb2bI-gfGyereNE/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/8nabOcclbn6vWb2bI-gfGyereNE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8nabOcclbn6vWb2bI-gfGyereNE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;One of the most common functionalities required in mobile applications is to call a web service to retrieve data. This process involves requesting the web service with parameters,&amp;nbsp;receiving&amp;nbsp;the response and parsing it to obtain data.&lt;br /&gt;
Today the most common web services types are &lt;b&gt;SOAP&lt;/b&gt; and &lt;b&gt;REST&lt;/b&gt;. Android does not provide a built in SOAP client, there are many third party libraries that can be used, but we'll see how to call a SOAP web service with native android APIs.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Requesting SOAP web service:&lt;/span&gt;&lt;/div&gt;Before proceeding to the code, let's take a look at the SOAP structure:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/web%20service/soap_structure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/web%20service/soap_structure.png" width="186" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
a soap request can be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:xml"&gt;POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.w3schools.com/GetItems"

&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"&amp;gt;
&amp;lt;soap:Header&amp;gt;
  &amp;lt;m:Trans xmlns:m="http://www.w3schools.com/transaction/"
  soap:mustUnderstand="1"&amp;gt;234
  &amp;lt;/m:Trans&amp;gt;
&amp;lt;/soap:Header&amp;gt;
&amp;lt;soap:Body&amp;gt;
  &amp;lt;m:GetPrice xmlns:m="http://www.w3schools.com/prices"&amp;gt;
    &amp;lt;m:Item&amp;gt;Apples&amp;lt;/m:Item&amp;gt;
  &amp;lt;/m:GetPrice&amp;gt;
&amp;lt;/soap:Body&amp;gt;&amp;lt;/soap:Envelope&amp;gt;

&lt;/pre&gt;&lt;br /&gt;
the SOAP request/response is sent as a &lt;b&gt;SOAP Envelope&lt;/b&gt; which consists of a &lt;b&gt;SOAP Header&lt;/b&gt; and a &lt;b&gt;SOAP Body&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;SOAP Header:&lt;/b&gt;&amp;nbsp;optional component of the envelop, contains application specific information, such as&amp;nbsp;authentication.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;SOAP Body:&lt;/b&gt; the actual message sent to/received from the service.&lt;/li&gt;
&lt;li&gt;The header can contain a &lt;b&gt;SOAP Action&lt;/b&gt; which identifies the desired function to be called by the service.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;b&gt;Calling the service:&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;to call the  SOAP web service you have to do the following:&lt;br /&gt;
&lt;b&gt;First:&lt;/b&gt; construct the SOAP envelope manually like this:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;String envelope="&amp;lt;?xml version=\"1.0\" encoding=\"utf-8\"?&amp;gt;"+
"&amp;lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&amp;gt;"+
  "&amp;lt;soap:Body&amp;gt;"+
    "&amp;lt;GetItems xmlns=\"http://tempuri.org/\"&amp;gt;"+
      "&amp;lt;startDate&amp;gt;%s&amp;lt;/ startDate&amp;gt;"+
      "&amp;lt;getAll&amp;gt;%s&amp;lt;/getAll&amp;gt;"+
    "&amp;lt;/Items&amp;gt;"+
  "&amp;lt;/soap:Body&amp;gt;"+
"&amp;lt;/soap:Envelope&amp;gt;";

&lt;/pre&gt;where &lt;b&gt;%s&lt;/b&gt; are place holders where you substitute request parameters in like this&lt;br /&gt;
&lt;pre class="brush:java"&gt;String requestEnvelope=String.format(envelope, "10-5-2011","true");
&lt;/pre&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Second:&lt;/b&gt; call the web service like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;String CallWebService(String url,
    String soapAction,
   String envelope)  {
  final DefaultHttpClient httpClient=new DefaultHttpClient();
  // request parameters
  HttpParams params = httpClient.getParams();
     HttpConnectionParams.setConnectionTimeout(params, 10000);
     HttpConnectionParams.setSoTimeout(params, 15000);
     // set parameter
  HttpProtocolParams.setUseExpectContinue(httpClient.getParams(), true);
  
  // POST the envelope
  HttpPost httppost = new HttpPost(url);
  // add headers
     httppost.setHeader("soapaction", soapAction);
     httppost.setHeader("Content-Type", "text/xml; charset=utf-8");
     
     String responseString="";
     try {
      
      // the entity holds the request
   HttpEntity entity = new StringEntity(envelope); 
   httppost.setEntity(entity);
   
   // Response handler
   ResponseHandler&lt;string&gt; rh=new ResponseHandler&lt;string&gt;() {
    // invoked when client receives response
    public String handleResponse(HttpResponse response)
      throws ClientProtocolException, IOException {
     
     // get response entity
     HttpEntity entity = response.getEntity();
     
     // read the response as byte array
           StringBuffer out = new StringBuffer();
           byte[] b = EntityUtils.toByteArray(entity);
           
           // write the response byte array to a string buffer
           out.append(new String(b, 0, b.length));        
           return out.toString();
    }
   };
   
   responseString=httpClient.execute(httppost, rh); 

  } 
     catch (Exception e) {
      Log.v("exception", e.toString());
  }
  
     // close the connection
  httpClient.getConnectionManager().shutdown();
  return responseString;
 }
&lt;/string&gt;&lt;/string&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
after calling this function, you will have the response as a String, something like this:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&amp;gt;
  &amp;lt;soap:Body&amp;gt;
    &amp;lt;GetItemsResponse xmlns="http://tempuri.org/"&amp;gt;
      &amp;lt;GetItemsResult&amp;gt;
        
        &amp;lt;Items&amp;gt;
          &amp;lt;Item&amp;gt;
            &amp;lt;name&amp;gt;string&amp;lt;/name&amp;gt;
            &amp;lt;description&amp;gt;string&amp;lt;/ description &amp;gt;
          &amp;lt;/iPhoneCategory&amp;gt;
          &amp;lt;iPhoneCategory&amp;gt;
            &amp;lt;name&amp;gt;string&amp;lt;/name&amp;gt;
            &amp;lt;description&amp;gt;string&amp;lt;/ description &amp;gt;
          &amp;lt;/ Item &amp;gt;
        &amp;lt;/Items&amp;gt;
      &amp;lt;/GetItemsResult&amp;gt;
    &amp;lt;/ GetItemsResponse &amp;gt;
  &amp;lt;/soap:Body&amp;gt;
&amp;lt;/soap:Envelope&amp;gt;

&lt;/pre&gt;&lt;br /&gt;
this response needs to be parsed to extract the data.&lt;/div&gt;&lt;/div&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/3614313680693372993-7109857722007390671?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/IoJqh7b_N00" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/7109857722007390671/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/06/calling-soap-web-services-with-android.html#comment-form" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7109857722007390671?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7109857722007390671?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/IoJqh7b_N00/calling-soap-web-services-with-android.html" title="Calling SOAP Web Services with Android APIs" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>13</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/06/calling-soap-web-services-with-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkINSHs5fCp7ImA9WhZVGUk.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-2258747806155608761</id><published>2011-06-01T11:49:00.001+02:00</published><updated>2011-06-01T18:09:59.524+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-01T18:09:59.524+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="web service" /><title>Calling REST Web Services with Android.</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/oHjSgUqfa9ylL95BYa0XsCt_lgc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/oHjSgUqfa9ylL95BYa0XsCt_lgc/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/oHjSgUqfa9ylL95BYa0XsCt_lgc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/oHjSgUqfa9ylL95BYa0XsCt_lgc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt;Requesting REST web service: &amp;nbsp;&lt;/b&gt; you request REST web services by calling a URL with the parameters. like this&lt;br /&gt;
&lt;pre&gt;http://example.com/resources/getitems&lt;/pre&gt;&lt;br /&gt;
an example of calling a REST web service:&lt;br /&gt;
&lt;pre class="brush:java"&gt;String callWebErvice(String serviceURL){
  // http get client
         HttpClient client=new DefaultHttpClient();
         HttpGet getRequest=new HttpGet();
         
         try {
          // construct a URI object
    getRequest.setURI(new URI(serviceURL));
   } catch (URISyntaxException e) {
    Log.e("URISyntaxException", e.toString());
   }
         
   // buffer reader to read the response
         BufferedReader in=null;
         // the service response
         HttpResponse response=null;
   try {
    // execute the request
    response = client.execute(getRequest);
   } catch (ClientProtocolException e) {
    Log.e("ClientProtocolException", e.toString());
   } catch (IOException e) {
    Log.e("IO exception", e.toString());
   }
         try {
    in=new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
   } catch (IllegalStateException e) {
    Log.e("IllegalStateException", e.toString());
   } catch (IOException e) {
    Log.e("IO exception", e.toString());
   }
         StringBuffer buff=new StringBuffer("");
         String line="";
         try {
    while((line=in.readLine())!=null)
    {
     buff.append(line);
    }
   } catch (IOException e) {
    Log.e("IO exception", e.toString());
    return e.getMessage();
   }
         
         
         try {
    in.close();
   } catch (IOException e) {
    Log.e("IO exception", e.toString());
   }
         // response, need to be parsed
         return buff.toString();
 }
&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-2258747806155608761?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/AR64wS-mYm8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/2258747806155608761/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/06/calling-rest-web-services-with-android.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/2258747806155608761?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/2258747806155608761?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/AR64wS-mYm8/calling-rest-web-services-with-android.html" title="Calling REST Web Services with Android." /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/06/calling-rest-web-services-with-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cMR3c6eSp7ImA9WhZVFE8.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-1862830674453450273</id><published>2011-05-26T18:58:00.000+02:00</published><updated>2011-05-26T18:58:06.911+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-26T18:58:06.911+02:00</app:edited><title>Official Google Blog: Coming soon: make your phone your wallet</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hXKRpugVJXV0cX5d3P76q5PMreY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hXKRpugVJXV0cX5d3P76q5PMreY/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/hXKRpugVJXV0cX5d3P76q5PMreY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hXKRpugVJXV0cX5d3P76q5PMreY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://googleblog.blogspot.com/2011/05/coming-soon-make-your-phone-your-wallet.html"&gt;Official Google Blog: Coming soon: make your phone your wallet&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-1862830674453450273?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/5pyiWn2dta4" height="1" width="1"/&gt;</content><link rel="related" href="http://googleblog.blogspot.com/2011/05/coming-soon-make-your-phone-your-wallet.html" title="Official Google Blog: Coming soon: make your phone your wallet" /><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/1862830674453450273/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/05/official-google-blog-coming-soon-make.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1862830674453450273?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/1862830674453450273?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/5pyiWn2dta4/official-google-blog-coming-soon-make.html" title="Official Google Blog: Coming soon: make your phone your wallet" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/05/official-google-blog-coming-soon-make.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUHSXo7cSp7ImA9WhZVEEg.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-7718093125234512311</id><published>2011-05-22T10:17:00.000+02:00</published><updated>2011-05-22T10:17:18.409+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-22T10:17:18.409+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SharedPreferences" /><title>Using Android Preferences</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/n_y-Ofg2pp1dOku5vwA-e6iDDW0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/n_y-Ofg2pp1dOku5vwA-e6iDDW0/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/n_y-Ofg2pp1dOku5vwA-e6iDDW0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/n_y-Ofg2pp1dOku5vwA-e6iDDW0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;We saw before that we can persist an application's data using SQLite database. Android offers another way to store user's data through using preferences.&lt;br /&gt;
&lt;br /&gt;
Android preferences is a key/value entries that store data that can be specific to a certain activity or shared among all activities within the application.&lt;br /&gt;
the data are stored in a xml file.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Saving Preferences&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
We can save preferences in three ways:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;Preferences can be retrieved only by a single activity.&lt;/li&gt;
&lt;li&gt;Preferences can be&amp;nbsp;shared and&amp;nbsp;retrieved&amp;nbsp;among all activities within the application.&lt;/li&gt;
&lt;li&gt;Preferences can be shared and&amp;nbsp;retrieved&amp;nbsp;through all applications on the device.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;b&gt;Saving Activity-level preferences:&lt;/b&gt;&lt;/div&gt;to save preferences that are accessed only from a single activity, we do it like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;SharedPreferences prefs=getPreferences(Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=prefs.edit();
        editor.putString("pref 1", "some text");
        
        editor.commit();
&lt;/pre&gt;&lt;br /&gt;
we get a &lt;b&gt;SharedPreferences&lt;/b&gt; object by calling &lt;b&gt;getPreferences(int mode)&lt;/b&gt; method which takes an integer value as a parameter, the mode value can be one of the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;Context.MODE_PRIVATE (0)&lt;/b&gt;: a file creating mode that makes the created file only accessible by applications with the same user ID (access the file from the same application context, will desctribe later).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Context.MODE_WORLD_READABLE (1)&lt;/b&gt;: file mode makes the file readable from other applications.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Context.MODE_WORLD_WRITEABLE (2)&lt;/b&gt;: file mode allows other applications to write to the file.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;then we get an instance of&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: monospace; white-space: pre;"&gt;&lt;b&gt;SharedPreferences.Editor &lt;/b&gt;&lt;/span&gt;and write the preference value with &lt;b&gt;editor.putString(String key, String value)&lt;/b&gt; method.&lt;br /&gt;
shared preferences allows you to insert preferences using the following methods:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;editor.putBoolean(String key, boolean value).&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;editor.putFloat(String key,float value).&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;editor.putInt(String key, int value).&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;editor.putLong(String key, long value)&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;editor.putString(String key, String value)&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;then we call &lt;b&gt;edit.commit() &lt;/b&gt;to save the preferences to the file. commit returns a boolean indicating the result of saving, true if successful and false if failed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Reading preferences values:&lt;/b&gt;&lt;/div&gt;To read preferences values:&lt;br /&gt;
&lt;pre class="brush:java"&gt;SharedPreferences prefs=getPreferences(Context.MODE_PRIVATE);
String val=prefs.getString("pref 1", "some text");
&lt;/pre&gt;we use sharedpreferences.getString(String key, String defaultValue) (or get boolean/float/int) to return the value stored with a specific key or defaultValue if not found.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Saving Application-level preferences:&lt;/b&gt;&lt;br /&gt;
to save preferences that can be retrieved from all activities in the application we do it like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;SharedPreferences prefs= getSharedPreferences("demopref", Context.MODE_WORLD_READABLE);
        SharedPreferences.Editor editor=prefs.edit();
        editor.putString("demostring", "hello");
        editor.commit();
&lt;/pre&gt;&lt;br /&gt;
same as the code above, but the difference is that we give our preferences file a name (demopref in this case) so that other activities can reference that preferences file.&lt;br /&gt;
&lt;b&gt;Sharing preferences across applications:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
We can store preferences in one application and read them in another application, this is done reading the preferences file by loading them through the first application's context.&lt;br /&gt;
&lt;br /&gt;
let's assume we have two applications:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;Application 1 with package name "com.mina.prefdemo".&lt;/li&gt;
&lt;li&gt;Application2 with package name "com.mina.demoapp".&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;If application1 creates a preferences file with the name "demopref" and inserts a String preference with the key/value "demostring/hello".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;now we access this file and value from application 2 like this:&lt;br /&gt;
&lt;pre class="brush:java"&gt;Context con;
  try {
   con = createPackageContext("com.minasamy.prefdemo", 0);
   SharedPreferences pref=con.getSharedPreferences("demopref", Context.MODE_PRIVATE);
   String x=pref.getString("demostring", "not found");
   txt.setText(x);
  } catch (NameNotFoundException e) {
   Log.e(Tag, e.toString());
  }
&lt;/pre&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Creating Preferences Activities:&lt;/span&gt;&lt;br /&gt;
android provides another nice way of presenting and saving preferences. you can create Activities that extend &lt;b&gt;PreferenceActivity&lt;/b&gt;.&lt;br /&gt;
PreferenceActivity is an activity that displays a set of built-in preferences related widgets that are defined in xml file.&lt;br /&gt;
&lt;br /&gt;
the preference activity can be divided to several&amp;nbsp;&lt;b&gt;PreferenceCategory&lt;/b&gt; each containing a set of related preferences.&lt;br /&gt;
The preferences widgets that Android provide are:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;CheckBoxPreference:&lt;/b&gt; displays a check box widget.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;EditTextPreference:&lt;/b&gt; displays an EditText widget to save user prefs.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;RingtonePreference:&lt;/b&gt; displays a list with the &amp;nbsp;ringtones on the device.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ListPreference:&lt;/b&gt; displays a list of key/value items.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;each one of these preferences widgets is associated with a preference key. it's value is persisted instantly as the widget selection changes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;we can construct our preferences screen xml (saved in res/xml directory) layout like this:&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt;
    &amp;lt;PreferenceCategory 
    android:title="Catogory one" 
    android:summary="sample summary"&amp;gt;
        &amp;lt;CheckBoxPreference
         android:title="Enable" 
         android:key="pref_enable" 
         android:summary="enables a preference"/&amp;gt;
        &amp;lt;EditTextPreference 
        android:summary="Edit text prefrence" 
        android:title="Edit" 
        android:key="pref_edit"/&amp;gt;
        
        
    &amp;lt;/PreferenceCategory&amp;gt;
    &amp;lt;PreferenceCategory 
    android:title="Category2" 
    android:summary="sample summary"&amp;gt;
        &amp;lt;RingtonePreference 
        android:key="pref_ring" 
        android:title="Ringtones preference"/&amp;gt;
        
        &amp;lt;ListPreference 
        android:key="pref_list" 
        android:title="List Preference" 
        android:dialogTitle="List Pref Dialog" 
        android:entries="@array/pref_items" 
        android:entryValues="@array/pref_items_values"/&amp;gt;
    &amp;lt;/PreferenceCategory&amp;gt;

&lt;/pre&gt;&lt;br /&gt;
then from our activity:&lt;br /&gt;
&lt;pre class="brush:java"&gt;public class PrefActivity extends PreferenceActivity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.prefs);
  
 }
}
&lt;/pre&gt;&lt;br /&gt;
and the activity will look like this:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs1.png" width="213" /&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://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs2.png" width="213" /&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://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs3.png" width="213" /&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://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://dl.dropbox.com/u/2624328/Android%20Pro/2011/May/prefs/prefs4.png" width="213" /&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;the &lt;b&gt;ListPreference&lt;/b&gt; can be associated with String array resources as it's key/value entries&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&amp;lt;string-array name="pref_items"&amp;gt;
    &amp;lt;item&amp;gt;Item1&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;Item2&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;Item3&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;Item4&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;Item5&amp;lt;/item&amp;gt;
    &amp;lt;/string-array&amp;gt;
    
    &amp;lt;string-array name="pref_items_values"&amp;gt;
    &amp;lt;item&amp;gt;1&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;2&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;3&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;4&amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;5&amp;lt;/item&amp;gt;
    &amp;lt;/string-array&amp;gt;

&lt;/pre&gt;&lt;br /&gt;
to reference the preference widgets programmatically:&lt;br /&gt;
&lt;pre class="brush:java"&gt;EditTextPreference pref_edit=(EditTextPreference)findPreference("pref_edit");
&lt;/pre&gt;&lt;/div&gt;&lt;/div&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/3614313680693372993-7718093125234512311?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/KI66s3OvN8c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/7718093125234512311/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/05/using-android-preferences.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7718093125234512311?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/7718093125234512311?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/KI66s3OvN8c/using-android-preferences.html" title="Using Android Preferences" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/05/using-android-preferences.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4GSXY7fCp7ImA9WhZWE08.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-4580483718470482811</id><published>2011-05-11T00:46:00.002+02:00</published><updated>2011-05-14T00:48:48.804+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-14T00:48:48.804+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Threading" /><category scheme="http://www.blogger.com/atom/ns#" term="Handler" /><category scheme="http://www.blogger.com/atom/ns#" term="AsyncTask" /><title>The Difference between Handler and AsyncTask</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6qIIktqKNYg4AyXy5kSjUMMUHXI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6qIIktqKNYg4AyXy5kSjUMMUHXI/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/6qIIktqKNYg4AyXy5kSjUMMUHXI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6qIIktqKNYg4AyXy5kSjUMMUHXI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
After we saw both Handlers and AsyncTasks a question may evolve: what's the difference between the two and when to use one of them over the other ?&lt;br /&gt;
&lt;br /&gt;
The Handler is associated with the application's main thread. it handles and schedules messages and runnables sent from background threads to the app main thread.&lt;br /&gt;
&lt;br /&gt;
AsyncTask provides a simple method to handle background threads in order to update the UI without blocking it by time consuming operations.&lt;br /&gt;
&lt;br /&gt;
The answer is that both can be used to update the UI from background threads, the difference would be in your execution scenario. You may consider using handler it you want to post delayed messages or send messages to the &amp;lt;strong&amp;gt;MessageQueue&amp;lt;/strong&amp;gt; in a specific order.&lt;br /&gt;
&lt;br /&gt;
You may consider using AsyncTask if you want to exchange parameters (thus updating UI) between the app main thread and background thread in an easy convinient way.&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/3614313680693372993-4580483718470482811?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/DHA6jsQh2a8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/4580483718470482811/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/05/difference-between-handler-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/4580483718470482811?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/4580483718470482811?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/DHA6jsQh2a8/difference-between-handler-and.html" title="The Difference between Handler and AsyncTask" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/05/difference-between-handler-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUENSHsyeCp7ImA9WhZWEEw.&quot;"><id>tag:blogger.com,1999:blog-3614313680693372993.post-3371104617339530240</id><published>2011-05-10T10:54:00.000+02:00</published><updated>2011-05-10T10:54:59.590+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-10T10:54:59.590+02:00</app:edited><title>Google to Unveil Service to Let Users Stream Their Music</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/L-jjIe4UIhgS1W_oTdpLupcD5fs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L-jjIe4UIhgS1W_oTdpLupcD5fs/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/L-jjIe4UIhgS1W_oTdpLupcD5fs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/L-jjIe4UIhgS1W_oTdpLupcD5fs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Google will announce today on Google I/O 2011 it's long anticipated Cloud-based music service.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3614313680693372993-3371104617339530240?l=android-pro.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LearnAndroid/~4/yjSqwnM2RWw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://android-pro.blogspot.com/feeds/3371104617339530240/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://android-pro.blogspot.com/2011/05/google-to-unveil-service-to-let-users.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3371104617339530240?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3614313680693372993/posts/default/3371104617339530240?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/LearnAndroid/~3/yjSqwnM2RWw/google-to-unveil-service-to-let-users.html" title="Google to Unveil Service to Let Users Stream Their Music" /><author><name>Mina Samy</name><uri>http://www.blogger.com/profile/17541163706855964717</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://android-pro.blogspot.com/2011/05/google-to-unveil-service-to-let-users.html</feedburner:origLink><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="enclosure" href="http://feedproxy.google.com/~r/LearnAndroid/~5/kcIc5355eiY/10google.html" length="0" /><feedburner:origEnclosureLink>http://www.nytimes.com/2011/05/10/technology/10google.html?_r=1</feedburner:origEnclosureLink></entry></feed>

