<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Framentos developers</title>
	<atom:link href="http://www.framentos.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.framentos.com</link>
	<description>&#34;Excellence is to do a common thing in an uncommon way&#34;</description>
	<lastBuildDate>Wed, 05 Jun 2013 12:43:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to start a Service at boot in Android</title>
		<link>http://www.framentos.com/en/android-tutorial/2012/08/01/how-to-start-a-service-at-boot-in-android/</link>
		<comments>http://www.framentos.com/en/android-tutorial/2012/08/01/how-to-start-a-service-at-boot-in-android/#comments</comments>
		<pubDate>Wed, 01 Aug 2012 14:49:30 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-tutorial]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=809</guid>
		<description><![CDATA[In this tutorial we will see how to launch a Service at boot startup in Android. Of course, as first step, we need the Service to be started: [..]]]></description>
				<content:encoded><![CDATA[<p>In this tutorial we will see how to launch a Service at boot startup in Android.<br />
Of course, as first step, we need the Service to be started:</p>
<p><span id="more-809"></span></p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">import android.app.Service;<br />
import android.content.Intent;<br />
import android.os.IBinder;<br />
<br />
public class StartAtBootService extends Service {<br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public IBinder onBind(Intent intent) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void onCreate() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // something to do when the service is created<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void onStart(Intent intent, int startId) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super.onStart(intent, startId);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // something to do when the service is started<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void onDestroy() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super.onDestroy();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // something to do when the service is destroyed<br />
&nbsp; &nbsp; }<br />
}</div></div>
<p>Then we need a BroadcastReceiver in which there is the method onReceive that will be called at the completion of the boot event.<br />
In it, we will launch the Service we&#8217;ve just created.</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">import android.content.BroadcastReceiver;<br />
import android.content.Context;<br />
import android.content.Intent;<br />
<br />
public class BootCompletedReceiver extends BroadcastReceiver{<br />
&nbsp; &nbsp; &nbsp;@Override<br />
&nbsp; &nbsp; &nbsp;public void onReceive(Context context, Intent intent) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Intent serviceIntent = new Intent(context, StartAtBootService.class);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;context.startService(serviceIntent);<br />
&nbsp; &nbsp; &nbsp;}<br />
}</div></div>
<p>Now we have to modify the AndroidManifest.xml file:</p>
<p>1) adding the permission to capture che event of the boot completed:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;</div></div>
<p>2) registering the Service:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;service android:name=&quot;.StartAtBootService&quot; &gt;&lt;/service&gt;</div></div>
<p>3) registering our BroadcastReceiver to receive that event:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;receiver<br />
&nbsp; &nbsp; &nbsp; &nbsp;android:name=&quot;.BootCompletedReceiver&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;android:enabled=&quot;true&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;android:exported=&quot;false&quot; &gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&lt;intent-filter&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&lt;/intent-filter&gt;<br />
&lt;/receiver&gt;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-tutorial/2012/08/01/how-to-start-a-service-at-boot-in-android/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to write &#8220;Hello World&#8221; into a NFC tag in Android.</title>
		<link>http://www.framentos.com/en/android-tutorial/2012/07/31/write-hello-world-into-a-nfc-tag-with-a/</link>
		<comments>http://www.framentos.com/en/android-tutorial/2012/07/31/write-hello-world-into-a-nfc-tag-with-a/#comments</comments>
		<pubDate>Tue, 31 Jul 2012 09:25:54 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-tutorial]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[nfc]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=766</guid>
		<description><![CDATA[When I started my experience with NFC technology finding a &#8220;Hello Word&#8221; tutorial to get minimal bases on NFC wasn&#8217;t so easy. For this I decided to write [..]]]></description>
				<content:encoded><![CDATA[<p>When I started my experience with NFC technology finding a &#8220;Hello Word&#8221; tutorial to get minimal bases on NFC wasn&#8217;t so easy.<br />
For this I decided to write it!<br />
In this tutorial we will see how it&#8217;s possible to write a String in a NFC tag.</p>
<p>What do we need?<br />
	1) a mobile phone with a nfc chip (Nexus S, Galaxy Nexus, Samsung Galaxy SIII ect&#8230;)<br />
	2) a NFC Tag. There are many website where it&#8217;s possible to buy them. I bought it here: http://www.tagage.net/tagage-shop/ . And In particular the one used for this tutorial is: Mifare Classic (Standard) &#8211; Rectangle (Racetrack)<br />
	3) An application to read the NFC to verify if our application works properly. (I use https://play.google.com/store/apps/details?id=com.nxp.nfc.tagwriter)</p>
<p><span id="more-766"></span></p>
<p>The goal of this tutorial is to build an application that can write a NFC tag following these steps:<br />
	1) Run manually the application<br />
	2) Write a String in a EditText<br />
	3) Put the mobile phone close to the tag<br />
	4) Push a button to write the string into the tag.</p>
<p><a href="http://www.framentos.com/android-tutorial/2012/07/31/write-hello-world-into-a-nfc-tag-with-a/attachment/nfc_screen/" rel="attachment wp-att-773"><img class="aligncenter size-large wp-image-773" title="nfc_screen" src="http://www.framentos.com/wp-content/uploads/nfc_screen-576x1024.png" alt="" width="250" height="500" /></a></p>
<p>Let&#8217;s start! I know the theoretical part is boring, but some snippets are needed.<br />
So we start with general information about nfc technology:</p>
<blockquote><p>NFC builds upon Radio-frequency identification (RFID) systems by allowing two-way communication between endpoints, where earlier systems such as contactless smart cards were one-way only.[6] Since unpowered NFC &#8220;tags&#8221; can also be read by NFC devices,[2] it is also capable of replacing earlier one-way applications.[Wikipedia]</p></blockquote>
<p>So with the NFC technology it&#8217;s possible to send messages (NDEF) between mobile-tag or mobile-mobile. NDEF messages were defined b y the <a title="NFC forum" href="http://www.nfc-forum.org/specs/spec_list/">NFC forum</a>.<br />
Obviously, Android supports this standards. In particular with Android there are two modes:</p>
<p>	1) Reading NDEF data from an NFC tag<br />
	2) Beaming NDEF messages from one device to another with Android Beam™</p>
<p>We are focusing on the first mode. It&#8217;s possible also to build non-NDEF message, but it&#8217;s over from the goals of this tutorial (For details <a title="Advanced NFC)" href="http://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html">Advanced NFC</a><br />
Ok, are we ready to code? No! We need just to understand how Android system works. When a tag is detected, the tag dispatch system analyzes it and starts an application to work on it. The system decides between the applications that have declared an <em>Intent filter.</em></p>
<blockquote><p>Reading NDEF data from an NFC tag is handled with the tag dispatch system, which analyzes discovered NFC tags, appropriately categorizes the data, and starts an application that is interested in the categorized data. An application that wants to handle the scanned NFC tag can declare an intent filter and request to handle the data. [Android Doc]</p></blockquote>
<p>According to that, our application has to:</p>
<p>	1) Declare an Intent Filter to announce to the system that it&#8217;s enabled to work on NFC.<br />
	2) Have a method that Android will call when NFC is detected.<br />
	3) Create a method to build a NDEF message.<br />
	4) Create a method to write the NDEF message.</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">NfcAdapter adapter<span style="color: #339933;">;</span><br />
PendingIntent pendingIntent<span style="color: #339933;">;</span><br />
IntentFilter writeTagFilters<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">boolean</span> writeMode<span style="color: #339933;">;</span><br />
Tag mytag<span style="color: #339933;">;</span><br />
<span style="color: #003399;">Context</span> ctx<span style="color: #339933;">;</span><br />
<br />
@Override<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; ctx<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">Button</span> btnWrite <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Button</span><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">button</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> TextView message <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span>findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">edit_message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; btnWrite.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>mytag<span style="color: #339933;">==</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>ctx, ctx.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">string</span>.<span style="color: #006633;">error_detected</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_LONG</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; write<span style="color: #009900;">&#40;</span>message.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,mytag<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>ctx, ctx.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">string</span>.<span style="color: #006633;">ok_writing</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_LONG</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>ctx, ctx.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">string</span>.<span style="color: #006633;">error_writing</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_LONG</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>FormatException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>ctx, ctx.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">string</span>.<span style="color: #006633;">error_writing</span><span style="color: #009900;">&#41;</span> , Toast.<span style="color: #006633;">LENGTH_LONG</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; adapter <span style="color: #339933;">=</span> NfcAdapter.<span style="color: #006633;">getDefaultAdapter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; pendingIntent <span style="color: #339933;">=</span> PendingIntent.<span style="color: #006633;">getActivity</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, getClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">addFlags</span><span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">FLAG_ACTIVITY_SINGLE_TOP</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; IntentFilter tagDetected <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> IntentFilter<span style="color: #009900;">&#40;</span>NfcAdapter.<span style="color: #006633;">ACTION_TAG_DISCOVERED</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; tagDetected.<span style="color: #006633;">addCategory</span><span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">CATEGORY_DEFAULT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; writeTagFilters <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> IntentFilter<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> tagDetected <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>In the <em>OnCreate</em> of our activity we set graphic elements like <em>Button</em>, in particular when you push it, the tag will be written (<em>write(message.getText().toString(),mytag);</em>). With last 5 rows we create a IntentFilter, so we tell Android that our application is enabled to work on nfc tag (<em>NfcAdapter.ACTION_TAG_DISCOVERED</em>). We could register our app directly with a intentFilter in the Manifest. In this way we couldn&#8217;t lunch our Activity like a simple program, but Android will boot it when it detects a tag. In both ways, after detecting and deciding which app has to work on with the tag, Android will call the method <em>onNewIntent</em> and pass the object <em>tag</em> to the activity:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@Override<br />
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onNewIntent<span style="color: #009900;">&#40;</span>Intent intent<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>NfcAdapter.<span style="color: #006633;">ACTION_TAG_DISCOVERED</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>intent.<span style="color: #006633;">getAction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mytag <span style="color: #339933;">=</span> intent.<span style="color: #006633;">getParcelableExtra</span><span style="color: #009900;">&#40;</span>NfcAdapter.<span style="color: #006633;">EXTRA_TAG</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">string</span>.<span style="color: #006633;">ok_detection</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> mytag.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_LONG</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>So now we have the object tag and we have to build the function to create the NDEF message and to write it into the NFC tag.</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">private</span> NdefRecord createRecord<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> text<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">UnsupportedEncodingException</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//create the message in according with the standard</span><br />
&nbsp; &nbsp; <span style="color: #003399;">String</span> lang <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> textBytes <span style="color: #339933;">=</span> text.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> langBytes <span style="color: #339933;">=</span> lang.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;US-ASCII&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> langLength <span style="color: #339933;">=</span> langBytes.<span style="color: #006633;">length</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> textLength <span style="color: #339933;">=</span> textBytes.<span style="color: #006633;">length</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> payload <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> langLength <span style="color: #339933;">+</span> textLength<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; payload<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> langLength<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// copy langbytes and textbytes into payload</span><br />
&nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">arraycopy</span><span style="color: #009900;">&#40;</span>langBytes, <span style="color: #cc66cc;">0</span>, payload, <span style="color: #cc66cc;">1</span>, langLength<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">arraycopy</span><span style="color: #009900;">&#40;</span>textBytes, <span style="color: #cc66cc;">0</span>, payload, <span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> langLength, textLength<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; NdefRecord recordNFC <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NdefRecord<span style="color: #009900;">&#40;</span>NdefRecord.<span style="color: #006633;">TNF_WELL_KNOWN</span>, NdefRecord.<span style="color: #006633;">RTD_TEXT</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>, payload<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> recordNFC<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> write<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> text, Tag tag<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>, FormatException <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; NdefRecord<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> records <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> createRecord<span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; NdefMessage message <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NdefMessage<span style="color: #009900;">&#40;</span>records<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; Ndef ndef <span style="color: #339933;">=</span> Ndef.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>tag<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; ndef.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; ndef.<span style="color: #006633;">writeNdefMessage</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; ndef.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>The NFC forum provides for NDEF message a structure with a payload and content. The payload contains information regarding how to interpret the information inside the NDEF message as language, coding etc&#8230; (for details: <a title="NDEF message" href="http://www.maintag.fr/fichiers/pdf-fr/nfcforum-ts-ndef-1-0.pdf">NDEF message</a> ). The behavior of the method <em>write</em> is enough clear: calls the method to create the NDEF message, opens a connection with the tag and writes the message into it.</p>
<p>Now we need to check if everything works in a proper way. If it is, we can read &#8220;HELLO WORLD!&#8221; inside the tag!! <img src='http://www.framentos.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<a title="HelloNFC" href="http://www.framentos.com/wp-content/uploads/HelloNFC.zip">Here</a> you can download the whole project. See you at our next tutorial!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-tutorial/2012/07/31/write-hello-world-into-a-nfc-tag-with-a/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>European judges slap Apple</title>
		<link>http://www.framentos.com/en/apple-news/2012/07/20/european-judges-slap-apple/</link>
		<comments>http://www.framentos.com/en/apple-news/2012/07/20/european-judges-slap-apple/#comments</comments>
		<pubDate>Fri, 20 Jul 2012 18:51:55 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[apple-news]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[iphone-news]]></category>
		<category><![CDATA[tablet]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=743</guid>
		<description><![CDATA[Terrible week for the company from Cupertino. An UK court has ordered Apple to publish  in several newspapers and post on its homepage that Samsung didn’t copy the [..]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.framentos.com/uncategorized/2012/07/20/european-judges-slap-apple/attachment/apple_samsung_case/" rel="attachment wp-att-746"><img src="http://www.framentos.com/wp-content/uploads/apple_samsung_case.jpeg" alt="" title="apple_samsung_case" width="280" height="300" class="alignleft size-full wp-image-746" /></a><br />
Terrible week for the company from Cupertino. An UK court has ordered Apple to publish  in several newspapers and post on its homepage that Samsung didn’t copy the iPad.</p>
<p>Some time ago Apple sued Samsung in front of an English court with charges of having copied the style of the iPad with their Galaxy Tablet asking to ban the sale of the tablet of the South Korea Manufacturers.</p>
<p><span id="more-743"></span></p>
<p>Following the images of the two tablets:</p>
<p><a href="http://www.framentos.com/uncategorized/2012/07/20/european-judges-slap-apple/attachment/ipad_galaxy/" rel="attachment wp-att-744"><img src="http://www.framentos.com/wp-content/uploads/Ipad_galaxy-300x206.jpeg" alt="Ipad_galaxy" title="Ipad_galaxy" width="300" height="206" class="aligncenter size-medium wp-image-744" /></a></p>
<p>Colin Birss, though, judge of the London Court rejected Apple&#8217;s request. But he did even more: he decided that Apple must publicly claim on its website for six months that Samsung didn’t copy the design of the iPad… like the famous punishments given to Bart Simpson!<br />
Over the motives of his decision the judge declared that Samsung&#8217;s tablets &#8220;are not as cool&#8221;.</p>
<p><a href="http://www.framentos.com/uncategorized/2012/07/20/european-judges-slap-apple/attachment/samsung_cool/" rel="attachment wp-att-745"><img src="http://www.framentos.com/wp-content/uploads/samsung_cool.png" alt="" title="samsung_cool" width="560" height="196" class="aligncenter size-full wp-image-745" /></a></p>
<p>As if that wasn&#8217;t enough for Apple, a German judge refused Apple&#8217;s request to ban the sale of the Motorola XOOM for the same reasons of the Galaxy Tablet.<br />
But there was a little consolation for Apple: the German court also rejected Motorola&#8217;s request to void the patent of the iPad design.</p>
<p>This last note sanctions that Motorola and Apple have both won and lost something and for that Motorola has been ordered to pay a third while Apple the remaining two third of the legal costs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/apple-news/2012/07/20/european-judges-slap-apple/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tutorial: ListView in Android using custom ListAdapter and Cache View</title>
		<link>http://www.framentos.com/en/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/</link>
		<comments>http://www.framentos.com/en/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/#comments</comments>
		<pubDate>Mon, 16 Jul 2012 18:48:47 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-tutorial]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=697</guid>
		<description><![CDATA[The aim of this article is to build a custom ListView for Android using a custom ListAdapter and a View Cache. In Android is very simple to build [..]]]></description>
				<content:encoded><![CDATA[<p>The aim of this article is to build a custom <em>ListView</em> for Android using a custom <em>ListAdapter</em> and a <em>View Cache</em>.<br />
In Android is very simple to build a list view until you don&#8217;t want change the row layout.<br />
Indeed, the customization of a ListView is very powerful, but it needs a bit of attention to optimize it and to make everything working in a proper way.<br />
But if you follow some simple practices, also putting a custom layout for the each row can became easy. <img src='http://www.framentos.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><span id="more-697"></span></p>
<p>The final result of this tutorial is:</p>
<p><a href="http://www.framentos.com/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/attachment/test-3/" rel="attachment wp-att-698"><img class="aligncenter size-medium wp-image-698" title="custom list view android" src="http://www.framentos.com/wp-content/uploads/test1-168x300.jpeg" alt="custom list view android" width="200" height="360" /></a></p>
<p>Here we want to build a list view to store information about a list of cities, in particular each row has to contain: an image of the city, the name and the related wikipedia link.<br />
So we start creating the city&#8217;s object:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.framentos.list</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> City <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> name<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> urlWiki<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> image<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> City<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name, <span style="color: #003399;">String</span> urlWiki, <span style="color: #003399;">String</span> image<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>. &nbsp; <span style="color: #006633;">urlWiki</span> <span style="color: #339933;">=</span> urlWiki<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">image</span> <span style="color: #339933;">=</span> image<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> name<span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> nameText<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; name <span style="color: #339933;">=</span> nameText<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getUrlWiki<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> urlWiki<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUrlWiki<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> urlWiki<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">urlWiki</span> <span style="color: #339933;">=</span> urlWiki<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> image<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setImage<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> image<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">image</span> <span style="color: #339933;">=</span> image<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>The second step is to create the layout that we want put in each row of our list view:</p>
<div class="codecolorer-container xml geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RelativeLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;80dip&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ImageView</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/ImageCity&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;90sp&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;90sp&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_toRightOf</span>=<span style="color: #ff0000;">&quot;@id/ImageCity&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span> </span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:paddingLeft</span>=<span style="color: #ff0000;">&quot;10sp&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/cityName&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:textSize</span>=<span style="color: #ff0000;">&quot;25sp&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/cityLinkWiki&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:autoLink</span>=<span style="color: #ff0000;">&quot;web&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:textSize</span>=<span style="color: #ff0000;">&quot;15sp&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/RelativeLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Now we have to create the custom <em>Adapter</em>. the following code shows a &#8220;simple&#8221; <em>Adapter</em> (without optimization ):</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.framentos.list</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Context</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.graphics.drawable.Drawable</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.LayoutInflater</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.ViewGroup</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ArrayAdapter</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ImageView</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.RelativeLayout</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CityListAdapter <span style="color: #000000; font-weight: bold;">extends</span> ArrayAdapter<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> resource<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> LayoutInflater inflater<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Context</span> context<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> CityListAdapter <span style="color: #009900;">&#40;</span> <span style="color: #003399;">Context</span> ctx, <span style="color: #000066; font-weight: bold;">int</span> resourceId, Listobjects<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span> ctx, resourceId, objects <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; resource <span style="color: #339933;">=</span> resourceId<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; inflater <span style="color: #339933;">=</span> LayoutInflater.<span style="color: #006633;">from</span><span style="color: #009900;">&#40;</span> ctx <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; context<span style="color: #339933;">=</span>ctx<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">View</span> getView <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #003399;">View</span> convertView, ViewGroup parent <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/* create a new view of my layout and inflate it in the row */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; convertView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> RelativeLayout <span style="color: #009900;">&#41;</span> inflater.<span style="color: #006633;">inflate</span><span style="color: #009900;">&#40;</span> resource, <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/* Extract the city's object to show */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; City city <span style="color: #339933;">=</span> getItem<span style="color: #009900;">&#40;</span> position <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/* Take the TextView from layout and set the city's name */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; TextView txtName <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> convertView.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">cityName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; txtName.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>city.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/* Take the TextView from layout and set the city's wiki link */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; TextView txtWiki <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> convertView.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">cityLinkWiki</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; txtWiki.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>city.<span style="color: #006633;">getUrlWiki</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">/* Take the ImageView from layout and set the city's image */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ImageView imageCity <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ImageView<span style="color: #009900;">&#41;</span> convertView.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">ImageCity</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> uri <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;drawable/&quot;</span> <span style="color: #339933;">+</span> city.<span style="color: #006633;">getImage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> imageResource <span style="color: #339933;">=</span> context.<span style="color: #006633;">getResources</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span>uri, <span style="color: #000066; font-weight: bold;">null</span>, context.<span style="color: #006633;">getPackageName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Drawable image <span style="color: #339933;">=</span> context.<span style="color: #006633;">getResources</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getDrawable</span><span style="color: #009900;">&#40;</span>imageResource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageCity.<span style="color: #006633;">setImageDrawable</span><span style="color: #009900;">&#40;</span>image<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> convertView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>The code is quite simple. In the constructor we save the custom layout (<em>resourceId</em>), create an object &#8220;<em>LayoutInflater</em>&#8221; (we will use it to create a view of our layout) and save the context (we will need it just to access the resources).<br />
Then we create method &#8220;getView&#8221;. Android will call it everytime it needs to render a row. In this method we:</p>
<p>	1) create a new View by <em>LayoutInflater</em> and put it into the row&#8217;s view(<em> convertView </em>).<br />
	2) take the number of the row (<em> position </em>) which has to be rendered and extract the correspondent city from the array.<br />
	3) find every graphic component from our view and set it with information.</p>
<p>Now the main activity which puts all together and its relative layout:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.framentos.list</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.framentos.list.R</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Context</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.AdapterView</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ListView</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.AdapterView.OnItemClickListener</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CityList <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">ListView</span> listViewCity<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Context</span> ctx<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">city_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ctx<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">List</span> listCity<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; listCity.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> City<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;London&quot;</span>,<span style="color: #0000ff;">&quot;http://en.wikipedia.org/wiki/London&quot;</span>,<span style="color: #0000ff;">&quot;london&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; listCity.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> City<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Rome&quot;</span>,<span style="color: #0000ff;">&quot;http://en.wikipedia.org/wiki/Rome&quot;</span>,<span style="color: #0000ff;">&quot;rome&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; listCity.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> City<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Paris&quot;</span>,<span style="color: #0000ff;">&quot;http://en.wikipedia.org/wiki/Paris&quot;</span>,<span style="color: #0000ff;">&quot;paris&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; listViewCity <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #003399;">ListView</span> <span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">city_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; listViewCity.<span style="color: #006633;">setAdapter</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> CityListAdapter<span style="color: #009900;">&#40;</span>ctx, R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">city_row_item</span>, listCity <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<div class="codecolorer-container xml geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ListView</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/city_list&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:paddingTop</span>=<span style="color: #ff0000;">&quot;20sp&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ListView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Our <em>Adapter</em> works in a proper way until we don&#8217;t populate our list with a lot of rows. If we do it we will see that the scrolling of the list will not be fluent.<br />
This is due to the fact that for the rendering of each row we create a new view and we take every graphic component from it (a lot <em>findViewById</em>).<br />
These operations are quite costly in terms of memory and cpu. To avoid it we can edit our adapter to use a <em>Cache View</em>.<br />
The code of <em>Cache View</em> will be:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.framentos.list</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ImageView</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> CityListViewCache <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">View</span> baseView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> TextView textNameCity<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> TextView textWikiCity<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> ImageView imageCity<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> CityListViewCache <span style="color: #009900;">&#40;</span> <span style="color: #003399;">View</span> baseView <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">baseView</span> <span style="color: #339933;">=</span> baseView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">View</span> getViewBase <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> baseView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> TextView getTextNameCity <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> resource<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> textNameCity <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textNameCity <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> TextView <span style="color: #009900;">&#41;</span> baseView.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">cityName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> textNameCity<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> TextView getTextWikiCity <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> resource<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> textWikiCity <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textWikiCity <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> TextView <span style="color: #009900;">&#41;</span> baseView.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">cityLinkWiki</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> textWikiCity<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> ImageView getImageView <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> resource<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> imageCity <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageCity <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> ImageView <span style="color: #009900;">&#41;</span> baseView.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">ImageCity</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> imageCity<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>And we edit our Adapter to use it:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Context</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.graphics.drawable.Drawable</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.text.Html</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.LayoutInflater</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.ViewGroup</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ArrayAdapter</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ImageView</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.RelativeLayout</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CityListAdapterWithCache <span style="color: #000000; font-weight: bold;">extends</span> ArrayAdapter<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> resource<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> LayoutInflater inflater<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Context</span> context<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> CityListAdapterWithCache <span style="color: #009900;">&#40;</span> <span style="color: #003399;">Context</span> ctx, <span style="color: #000066; font-weight: bold;">int</span> resourceId, Listobjects<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span> ctx, resourceId, objects <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; resource <span style="color: #339933;">=</span> resourceId<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; inflater <span style="color: #339933;">=</span> LayoutInflater.<span style="color: #006633;">from</span><span style="color: #009900;">&#40;</span> ctx <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; context<span style="color: #339933;">=</span>ctx<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">View</span> getView <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #003399;">View</span> convertView, ViewGroup parent <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; City city <span style="color: #339933;">=</span> getItem<span style="color: #009900;">&#40;</span> position <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; CityListViewCache viewCache<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> convertView <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; convertView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> RelativeLayout <span style="color: #009900;">&#41;</span> inflater.<span style="color: #006633;">inflate</span><span style="color: #009900;">&#40;</span> resource, <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewCache <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CityListViewCache<span style="color: #009900;">&#40;</span> convertView <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; convertView.<span style="color: #006633;">setTag</span><span style="color: #009900;">&#40;</span> viewCache <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; convertView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> RelativeLayout <span style="color: #009900;">&#41;</span> convertView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewCache <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> CityListViewCache <span style="color: #009900;">&#41;</span> convertView.<span style="color: #006633;">getTag</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; TextView txtName <span style="color: #339933;">=</span> viewCache.<span style="color: #006633;">getTextNameCity</span><span style="color: #009900;">&#40;</span>resource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; txtName.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>city.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; TextView txtWiki <span style="color: #339933;">=</span> viewCache.<span style="color: #006633;">getTextWikiCity</span><span style="color: #009900;">&#40;</span>resource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; txtWiki.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>city.<span style="color: #006633;">getUrlWiki</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ImageView imageCity <span style="color: #339933;">=</span> viewCache.<span style="color: #006633;">getImageView</span><span style="color: #009900;">&#40;</span>resource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> uri <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;drawable/&quot;</span> <span style="color: #339933;">+</span> city.<span style="color: #006633;">getImage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> imageResource <span style="color: #339933;">=</span> context.<span style="color: #006633;">getResources</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span>uri, <span style="color: #000066; font-weight: bold;">null</span>, context.<span style="color: #006633;">getPackageName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Drawable image <span style="color: #339933;">=</span> context.<span style="color: #006633;">getResources</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getDrawable</span><span style="color: #009900;">&#40;</span>imageResource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; imageCity.<span style="color: #006633;">setImageDrawable</span><span style="color: #009900;">&#40;</span>image<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> convertView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>In this case, when the system wants to render a row, it uses the cache class to take every component from our layout (getTextNameCity, getTextWikiCity, getImageView).<br />
In this way our ListView will be fine to contain many rows. <img src='http://www.framentos.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Last note it&#8217;s to remind you that every interaction between the user and the rows will be lost if they aren&#8217;t saved.<br />
Android renders the rows which have to be showed. When they disappear from screen they are destroyed (the system attempts to keep a few of them until he doesn&#8217;t have memory problem).<br />
For example, we have a checkbox in each row and the user clicks in a particular row and changes its status (from off to on) and after he scrolls the listview.<br />
If after the user goes back on that row he will see that the status of the checkbox is off. So pay attention to create a way to save the interaction between user and your listView.</p>
<p>You can download the complete project <a title="Here" href="http://www.framentos.com/wp-content/uploads/Android_custom_list_view_example.zip" target="_blank">here </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Google Maps updates the world</title>
		<link>http://www.framentos.com/en/android-news/2012/07/13/google-maps-updates-all-world/</link>
		<comments>http://www.framentos.com/en/android-news/2012/07/13/google-maps-updates-all-world/#comments</comments>
		<pubDate>Fri, 13 Jul 2012 14:22:10 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-news]]></category>
		<category><![CDATA[google-news]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google-maps]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=619</guid>
		<description><![CDATA[How many engineers work on Google Maps? The question comes out of the last three news about it. In fact Google has announced three big news: cycle routes [..]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.framentos.com/android-news/2012/07/13/google-maps-updates-all-world/attachment/android-google-maps/" rel="attachment wp-att-620"><img class="alignleft size-full wp-image-620" title="android google maps icon" src="http://www.framentos.com/wp-content/uploads/android-google-maps.jpeg" alt="android google maps icon" width="275" height="319" /></a>How many engineers work on Google Maps? The question comes out of the last three news about it.<br />
In fact Google has announced three big news: cycle routes for Europe, indoor Google Maps has been added in 20 American museum and walking route for Africa.</p>
<p><span id="more-619"></span></p>
<p>Let&#8217;s start with the first feature. In 2010 Google added the possibility to calculate bike routes in the USA and Canada. It allows to find recommended streets as bike trails, lanes and roads with less traffic. Moreover when Googles calculates a new route it avoids strenuous uphill roads.</p>
<p>To find the best roads for bikes it is not an easy task, and expert bikers are the only ones who could probably figure it out. Therefore it&#8217;s possible for users to add new safe roads or report the ones which is better to avoid.<br />
Biking directions are now available in Austria, Australia, Belgium, Denmark, Finland, Netherlands, Norway, Sweden, Switzerland and the United Kingdom.<br />
It&#8217;s important to highlight that this feature is still a beta version.</p>
<p>Following is Google&#8217;s video presenting the service in 2010.</p>
<p><object width="480" height="390" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/JN5_NBSu7Lw" /><param name="allowfullscreen" value="true" /><embed width="480" height="390" type="application/x-shockwave-flash" src="http://www.youtube.com/v/JN5_NBSu7Lw" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object></p>
<p>After bicycles, Google spoils his users with art. In fact Indoor Google Maps has been enriched with over twenty American museums.<br />
Now we can visit them supported  by Android phones and see map, walking routes and get information about works of art.</p>
<p>The attractions that have been mapped so far are the National Museum of American History; the National Museum of Natural History; the National Postal Museum and the Renwick Gallery &#8211; all in Washington DC.<br />
And also: the Chantilly&#8217;s National Air and Space Museum, the Steven F. Udvar-Hazy Center and the National Museum of the American Indian, the George Gustav Heye Center in New York.</p>
<p>A Google spokesman said: &#8220;Along with the Google Art Project, indoor mapping is one more way we&#8217;re working with museums to bring greater access to revered cultural and educational institutions around the world.&#8221;</p>
<p>With 2.7 million sq ft of interiors, we are sure that Google is getting his goal.</p>
<div id="attachment_621" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.framentos.com/android-news/2012/07/13/google-maps-updates-all-world/attachment/space-museum/" rel="attachment wp-att-621"><img class="size-full wp-image-621" title="space museum google maps indoor" src="http://www.framentos.com/wp-content/uploads/space-museum-e1342188916519.png" alt="space museum google maps indoor" width="500" height="330" /></a><p class="wp-caption-text">Indoor walking directions in the National Air and Space Museum - Smithsonian Institution, Washington, DC.</p></div>
<p>After Europe and America it&#8217;s the turn of Africa. Google has announced that now the walking directions through Google Maps is available in 44 African countries.<br />
Also in this case Google Maker is available to create and update geographic information.</p>
<div id="attachment_622" class="wp-caption aligncenter" style="width: 330px"><a href="http://www.framentos.com/android-news/2012/07/13/google-maps-updates-all-world/attachment/maps-africa/" rel="attachment wp-att-622"><img class="size-full wp-image-622" title="maps africa" src="http://www.framentos.com/wp-content/uploads/maps-africa-e1342188890301.png" alt="Africa African countries Google Maps Android" width="320" height="298" /></a><p class="wp-caption-text">African countries where Google Maps is available.</p></div>
<p>In conclusion, this week has been very rich for Google Maps. While trying to extricate the legal processes for the privacy, Google is also pointing quickly to his pharaonic aim to map and take photos of the whole world &#8230;. will Google be able to do it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-news/2012/07/13/google-maps-updates-all-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nexus 7: Google&#8217;s Trojan Horse to enter a new market?</title>
		<link>http://www.framentos.com/en/android-news/2012/07/12/nexus-7-googles-trojan-horse-to-enter-a-new-market/</link>
		<comments>http://www.framentos.com/en/android-news/2012/07/12/nexus-7-googles-trojan-horse-to-enter-a-new-market/#comments</comments>
		<pubDate>Thu, 12 Jul 2012 16:37:08 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-news]]></category>
		<category><![CDATA[google-news]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[tablet]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=570</guid>
		<description><![CDATA[Google launched the Nexus 7 as the new Google&#8217;s tablet.  Through this product it is clear the Google&#8217;s will to conquer the small tablet market. Google wants to [..]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.framentos.com/android-news/2012/07/12/nexus-7-googles-trojan-horse-to-enter-a-new-market/attachment/android-with-amazon-smile/" rel="attachment wp-att-573"><img src="http://www.framentos.com/wp-content/uploads/android-with-amazon-smile-253x300.png" alt="Android Google Amazon" title="android-with-amazon-smile" width="253" height="300" class="alignleft size-medium wp-image-573" /></a></p>
<p>Google launched the Nexus 7 as the new Google&#8217;s tablet.  Through this product it is clear the Google&#8217;s will to conquer the small tablet market.<br />
Google wants to improve his new Play-Store with movie, games and in particular books to compete with the principal colossus of this market: Amazon.</p>
<p><span id="more-570"></span></p>
<p>Although with his Kindle Fire on sale for $199 Amazon is the owner of the small tablets market, Google is trying to enter this business by lunching the Nexus 7 for 199$ for the 8Gb version or 249$ for the 16Gb.<br />
Usually Google focuses on high-level products like Google Nexus. The unusual thing is not the new strategy, but the fact that the profit from Nexus 7 for Google is approximately equal to 0$. </p>
<p>Also, according to an iSuppli report the cost of components to build one exemplary of Nexus 7 is 159.25$ (for the 8Gb version) and then adding the costs for marketing and distribution the Google&#8217;s profit disappears.<br />
Following is the list of Nexus 7 components with the relative prices: (<a href="http://www.isuppli.com/Teardowns/News/Pages/Low-End-Google-Nexus-7-Carries-$157-BOM-Teardown-Reveals.aspx" title="iSuppli">source</a> )</p>
<p><a href="http://www.framentos.com/android-news/2012/07/12/nexus-7-googles-trojan-horse-to-enter-a-new-market/attachment/isuppli-image-nexus-components/" rel="attachment wp-att-576"><img src="http://www.framentos.com/wp-content/uploads/isuppli-image-nexus-components.jpeg" alt="" title="isuppli-image-nexus-components" width="527" height="379" class="aligncenter size-full wp-image-576" /></a></p>
<p>It&#8217;s clear that Google wants to get a big part of the market and they are ready to lose the Nexus&#8217; profits to achieve their goal.<br />
A curious feature about Nexus 7 is the new magnetic sensor on board, unusual for Google&#8217;s products, which gives the tablet the possibility to mount a &#8220;smart cover&#8221;.<br />
Obviously as it is possible to imagine, even if Google&#8217;s partners such as Asus, Samsung, LG will not be happy about Google&#8217;s strategy, we are pretty sure that the clients will appreciate it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-news/2012/07/12/nexus-7-googles-trojan-horse-to-enter-a-new-market/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does FBI want to spy on everyone?</title>
		<link>http://www.framentos.com/en/internet/2012/05/08/fbi-wants-to-spy-on-everyone/</link>
		<comments>http://www.framentos.com/en/internet/2012/05/08/fbi-wants-to-spy-on-everyone/#comments</comments>
		<pubDate>Tue, 08 May 2012 21:17:44 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=534</guid>
		<description><![CDATA[Bad news for Internet freedom. Just when Anonymous, the famous group of hackers, is breaking sites around the world for Internet freedom, the FBI prepares the countermoves against [..]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.framentos.com/internet/2012/05/08/fbi-wants-to-spy-on-everyone/attachment/120505122446737/" rel="attachment wp-att-546"><img src="http://www.framentos.com/wp-content/uploads/120505122446737-300x213.png" alt="" title="FBI spy on web" width="300" height="213" class="alignleft size-medium wp-image-546" /></a><br />
Bad news for Internet freedom.<br />
Just when Anonymous, the famous group of hackers, is breaking sites around the world for Internet freedom, the FBI prepares the countermoves against them.<br />
The FBI wants legal backdoors in the principal services of the Internet like Facebook, Google or Skype according to the CNET report.</p>
<p><span id="more-534"></span></p>
<p>The principal purpose of the FBI is to be able to investigate about terroristic acts or cyber-attack trough these services.<br />
 The agency is concerned about what they call “Going Dark”, or losing the ability to intercept communication as technology expands.</p>
<p>As CNET&#8217;s Declan McCullagh reported Friday, &#8220;The FBI is asking Internet companies not to oppose a controversial proposal that would require firms, including Microsoft, Facebook, Yahoo, and Google, to build in backdoors for government surveillance.&#8221;<br />
The issue, says the Bureau, is that &#8220;the dramatic shift in communication from the telephone system to the Internet has made it far more difficult for agents to wiretap Americans suspected of illegal activities”.</p>
<p>For McCullagh, the Secret Service would like to extend the Communications Assistance of the Law Enforcement Act (CALEA) of 1994, the law which allows them to intercept the communication for the government surveillance, but currently it covers telecommunications and just part of the Internet (VOIP and providers).</p>
<p>For the FBI all that is necessary because the traditional communication by phone is declining in favor of a communication trough TCP/IP technologies.<br />
The FBI&#8217;s target are not just Social Networks, IM and Search Engines, but they would like to integrate also business of game as XBOX Live and cloud services. </p>
<p>On the contrary, the Electronic Frontier Foundation (EFF) says that the law CALEA could move away foreign investors who would move the &#8220;research and develop&#8221; of their products in other countries to avoid problems like this.<br />
Also the EFF claims that this law could create an &#8220;hidden business&#8221; of products without backdoors.</p>
<p>Business, security, marketing &#8230;.. maybe they are getting too many hands on the user’s data!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/internet/2012/05/08/fbi-wants-to-spy-on-everyone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Samsung: flexible AMOLED by 2013</title>
		<link>http://www.framentos.com/en/smartphone/2012/03/04/samsung-flexible-amoled-by-2013/</link>
		<comments>http://www.framentos.com/en/smartphone/2012/03/04/samsung-flexible-amoled-by-2013/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 15:45:01 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[smartphone]]></category>
		<category><![CDATA[newsmartphone]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=486</guid>
		<description><![CDATA[Samsung is about to revolutionise the smartphone market. Already in 2011 we had a preview of the Samsung&#8217;s work: the flexible AMOLED. It&#8217;s a technology that will allow [..]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.framentos.com/smartphone/2012/03/04/samsung-flexible-amoled-by-2013/attachment/samsung-flexible-amoled-bendy-display-0/" rel="attachment wp-att-495"><img class="alignleft size-medium wp-image-495" title="samsung-flexible-amoled-bendy-display-0" src="http://www.framentos.com/wp-content/uploads/samsung-flexible-amoled-bendy-display-0-300x276.jpg" alt="" width="300" height="276" /></a>Samsung is about to revolutionise the smartphone market. Already in 2011 we had a preview of the Samsung&#8217;s work: the flexible AMOLED.</p>
<p>It&#8217;s a technology that will allow to produce glassless screens, so they will be extremely resistant and flexible.<br />
During the CES 2011 we had some demonstrations on this technology, but now we have some news.</p>
<p><span id="more-486"></span></p>
<p>In fact during the Mobile World Conference 2012, a Samsung&#8217;s member team has announced that the first screens with flexible AMOLED will be in production by next year.<br />
With flexible AMOLED, in addition to revolutionize the world of smartphones, Samsung opens up huge markets, in particular the production of gadgets such as ergonomic clocks-smartphones, but also touchable newspapers or semi-transparent screen.</p>
<p>Now we can only dream and enjoy the demonstration of 2011!</p>
<p><object width="480" height="390" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/HU2nG9qy6vs" /><param name="allowfullscreen" value="true" /><embed width="480" height="390" type="application/x-shockwave-flash" src="http://www.youtube.com/v/HU2nG9qy6vs" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object></p>
<p><object width="480" height="390" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/kJEHp15Hoo0" /><param name="allowfullscreen" value="true" /><embed width="480" height="390" type="application/x-shockwave-flash" src="http://www.youtube.com/v/kJEHp15Hoo0" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/smartphone/2012/03/04/samsung-flexible-amoled-by-2013/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Samsung Galaxy s3 is coming!</title>
		<link>http://www.framentos.com/en/android-news/2012/03/04/samsung-galaxy-s3-is-coming/</link>
		<comments>http://www.framentos.com/en/android-news/2012/03/04/samsung-galaxy-s3-is-coming/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 10:41:48 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-news]]></category>
		<category><![CDATA[smartphone]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[newsmartphone]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=483</guid>
		<description><![CDATA[As expected, Samsung did&#8217;t present the new Galaxy III at the Mobile World Congress of Barcelona, held from 27th February to 1st March. Samsung has decided to wait [..]]]></description>
				<content:encoded><![CDATA[<p><img alt="" src="http://www.framentos.com/wp-content/uploads/galaxy-s3.jpg" title="google docs Android" class="alignleft" width="330" height="260" /> As expected, Samsung did&#8217;t present the new Galaxy III at the Mobile World Congress of Barcelona, held from 27th February to 1st March.<br />
Samsung has decided to wait a little bit longer and now it seems that the new smartphone will be launched at the end of April 2012.<br />
<span id="more-483"></span></p>
<p>This rumour comes from a very reliable source,  <strong>Cheil Worldwide</strong>, the Samsung marketing agency.<br />
It seems that there will be a very big advertising campaign, strongly based on the next Olympic Games of London in the next summer.</p>
<p>The Samsung Galaxy III will have a Full HD 1080p screen of 4.8 inches and a 1.5 GHz Quad Core CPU.<br />
Obviously, it will have two cameras: one on the back with 8.0 or 12.0 megapixels and the other in the front of 2.0 megapixels.<br />
A very important innovation is represented by the material used for the case, for the first time it will be ceramic. If this is true, the quality will be definetely better than the plastic one used in all the current models.</p>
<p>The presentation will be in the end of March, one month before the launch on the world market&#8230;we are waiting impatiently!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-news/2012/03/04/samsung-galaxy-s3-is-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to prevent Wi-Fi sleep on Android</title>
		<link>http://www.framentos.com/en/android-tutorial/2012/02/27/how-to-prevent-wi-fi-sleep-on-android/</link>
		<comments>http://www.framentos.com/en/android-tutorial/2012/02/27/how-to-prevent-wi-fi-sleep-on-android/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 20:55:45 +0000</pubDate>
		<dc:creator>Framentos Developers</dc:creator>
				<category><![CDATA[android-tutorial]]></category>
		<category><![CDATA[acquire]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[android snippet]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wi-fi]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://www.framentos.com/?p=425</guid>
		<description><![CDATA[With this tutorial, we will explain how it is possible to get the control on Wi-Fi resource in order to prevent it to go in stand-by. This is [..]]]></description>
				<content:encoded><![CDATA[<p>With this tutorial, we will explain how it is possible to get the control on Wi-Fi resource in order to prevent it to go in stand-by. This is necessary if you need the Wi-Fi connection in your app even if the user has set the Wi-Fi to go in sleep mode when the device is in stand-by.<br />
<span id="more-425"></span><br />
First of all you need the permission to use the Wi-Fi resource. To obtain this permission, just add in your <em>AndroidManifest.xml</em> the following:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">uses<span style="color: #339933;">-</span>permission android<span style="color: #339933;">:</span>name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;android.permission.WAKE_LOCK&quot;</span><span style="color: #339933;">;</span></div></div>
<p>In your Activity, import the libraries and get the WIFI_SERVICE with WifiManager object. With this object, you can create a WifiLock and after you can acquire the lock on this:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.net.wifi.WifiManager</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.net.wifi.WifiManager.WifiLock</span><span style="color: #339933;">;</span><br />
<br />
<br />
WifiManager wifiManager <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>WifiManager<span style="color: #009900;">&#41;</span> getSystemService<span style="color: #009900;">&#40;</span><span style="color: #003399;">Context</span>.<span style="color: #006633;">WIFI_SERVICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
WifiLock lock <span style="color: #339933;">=</span> wifiManager.<span style="color: #006633;">createWifiLock</span><span style="color: #009900;">&#40;</span>WifiManager.<span style="color: #006633;">WIFI_MODE_FULL</span>, <span style="color: #0000ff;">&quot;LockTag&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
lock.<span style="color: #006633;">acquire</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>It is possible to create different types of locks:</p>
<li> WIFI_MODE_FULL (Wi-Fi will be kept active, and will behave normally)</li>
<li>WIFI_MODE_FULL_HIGH_PERF (Wi-Fi will be kept active and it operates at high performance with minimum packet loss)</li>
<li>WIFI_MODE_SCAN_ONLY (Wi-Fi will be kept active, but the only operation that will be supported is initiation of scans)</li>
<p>The <em>tag</em> is to identify the WifiLock in debugging messages. It is never shown to the user.</p>
<blockquote><p><strong>IMPORTANT:</strong> You should always think if you really need to get the lock on Wi-Fi resource. Please consider battery life when you create your app.</p></blockquote>
<p>When your job is done, remeber to release the lock on Wi-Fi resource:</p>
<div class="codecolorer-container java geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">lock.<span style="color: #006633;">release</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.framentos.com/en/android-tutorial/2012/02/27/how-to-prevent-wi-fi-sleep-on-android/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	
</channel>
</rss>
