<?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>Communauté française android news, news du Web et bien d&#039;autres domaines &#187; activity</title>
	<atom:link href="http://www.android-inside.com/tag/activity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.android-inside.com</link>
	<description>telephones, smart phones android, programmation et applications, news twitter facebook</description>
	<lastBuildDate>Thu, 01 Dec 2011 21:34:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Projet android par etapes : Applications EarthQuake</title>
		<link>http://www.android-inside.com/2009/11/projet-android-par-etapes-applications-desearthquake/</link>
		<comments>http://www.android-inside.com/2009/11/projet-android-par-etapes-applications-desearthquake/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 23:20:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[activity]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[earthquake]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://www.android-inside.com/?p=136</guid>
		<description><![CDATA[Les grandes etapes de projets: Demarrer un projet adroid, creer des classes Utiliser un adpater pour afficher des infos dans une Lsitview effectuer  la mise a jour via un site web Transfomer l&#8217;application en service 1) Etape 1 On suppose que la création d&#8217;un projet ne vous pose pas de problemes et dans ce cas [...]


Related posts:<ol><li><a href='http://www.android-inside.com/2009/11/earthqauke-suite-du-projet-android/' rel='bookmark' title='Earthquake suite du projet android'>Earthquake suite du projet android</a></li>
<li><a href='http://www.android-inside.com/2009/11/suite-projet-erathquake-les-preferences/' rel='bookmark' title='Suite projet Erathquake : les preferences'>Suite projet Erathquake : les preferences</a></li>
<li><a href='http://www.android-inside.com/2009/11/services-sous-android-lecon-1/' rel='bookmark' title='Services sous android Leçon 1'>Services sous android Leçon 1</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<h3>Les grandes etapes de projets:</h3>
<ol>
<li>Demarrer un projet adroid, creer des classes</li>
<li>Utiliser un adpater pour afficher des infos dans une Lsitview</li>
<li>effectuer  la mise a jour via un site web</li>
<li>Transfomer l&#8217;application en service</li>
</ol>
<h3>1) Etape 1</h3>
<p>On suppose que la création d&#8217;un projet ne vous pose pas de problemes et dans ce cas on attaque directment le code :</p>
<p>Ceci est une simple classe qui contient des informations relatives a claque tremblement de Terre: ces infos seront affichees dans une ListView</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.almassa.Earthquake</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.text.SimpleDateFormat</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.location.Location</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/***
 * class sued to store all information about an earhquake
 * @author adam
 *
 */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Quake <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Date</span> mDate<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> mDetails<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> Location mLocation<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span> mMagnitude<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> mLink<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Getters</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Date</span> getDate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">return</span> mDate<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getDetails<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span> mDetails<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> Location getLocation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span> mLocation<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">double</span> getMagnitude<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span> mMagnitude<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getLink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span> mLink<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Constructor</span>
	<span style="color: #000000; font-weight: bold;">public</span> Quake<span style="color: #009900;">&#40;</span><span style="color: #003399;">Date</span> date, <span style="color: #003399;">String</span> details, Location location, <span style="color: #000066; font-weight: bold;">double</span> magnitude, <span style="color: #003399;">String</span> link<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		mDate <span style="color: #339933;">=</span> date<span style="color: #339933;">;</span>
		mDetails <span style="color: #339933;">=</span> details<span style="color: #339933;">;</span>
		mLocation <span style="color: #339933;">=</span> location<span style="color: #339933;">;</span>
		mMagnitude <span style="color: #339933;">=</span> magnitude<span style="color: #339933;">;</span>
		mLink <span style="color: #339933;">=</span> link<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// tostirng method</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">SimpleDateFormat</span> sd <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">SimpleDateFormat</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HH:mm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> dateformat <span style="color: #339933;">=</span> sd.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span>mDate<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> dateformat<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; : &quot;</span><span style="color: #339933;">+</span> mMagnitude<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">+</span>mDetails<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>



<p>Related posts:<ol><li><a href='http://www.android-inside.com/2009/11/earthqauke-suite-du-projet-android/' rel='bookmark' title='Earthquake suite du projet android'>Earthquake suite du projet android</a></li>
<li><a href='http://www.android-inside.com/2009/11/suite-projet-erathquake-les-preferences/' rel='bookmark' title='Suite projet Erathquake : les preferences'>Suite projet Erathquake : les preferences</a></li>
<li><a href='http://www.android-inside.com/2009/11/services-sous-android-lecon-1/' rel='bookmark' title='Services sous android Leçon 1'>Services sous android Leçon 1</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.android-inside.com/2009/11/projet-android-par-etapes-applications-desearthquake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Services sous android Leçon 1</title>
		<link>http://www.android-inside.com/2009/11/services-sous-android-lecon-1/</link>
		<comments>http://www.android-inside.com/2009/11/services-sous-android-lecon-1/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 15:44:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[activity]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://www.android-inside.com/?p=118</guid>
		<description><![CDATA[A la différence des activités qui présentent une interface graphique a l'utilisateur, les services  s'exécutent en tache de fond


Related posts:<ol><li><a href='http://www.android-inside.com/2009/11/earthqauke-suite-du-projet-android/' rel='bookmark' title='Earthquake suite du projet android'>Earthquake suite du projet android</a></li>
<li><a href='http://www.android-inside.com/2009/11/travailler-avec-les-preferences-sous-android/' rel='bookmark' title='Travailler avec les preferences sous ANDROID'>Travailler avec les preferences sous ANDROID</a></li>
<li><a href='http://www.android-inside.com/2009/11/projet-android-par-etapes-applications-desearthquake/' rel='bookmark' title='Projet android par etapes : Applications EarthQuake'>Projet android par etapes : Applications EarthQuake</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A la différence des activités qui présentent une interface graphique a l&#8217;utilisateur, les services  s&#8217;exécutent en tache de fond</p>
<p>Une fois le service crée il faut l&#8217;enregistrer aupres de l&#8217;application<br />
Pour démarrer un service on fait appel a startService();<br />
Si le service requiert des permissions que l&#8217;application ne possède pas alors cet appel lancera une exception</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyService <span style="color: #000000; font-weight: bold;">extends</span> Service <span style="color: #009900;">&#123;</span>
&nbsp;
  @Override
  <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><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// What to do when service is created</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> IBinder onBind<span style="color: #009900;">&#40;</span>Intent intent<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// Replace with service binding implementation</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// Action to perform when service starts</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// techniques pour demarrer un service</span>
<span style="color: #666666; font-style: italic;">// implicite</span>
startService<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span>MyService.<span style="color: #006633;">MY_ACTION</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Explicite</span>
startService<span style="color: #009900;">&#40;</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>,MYService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// stop service en appelant la methode stopService et en lui passant</span>
<span style="color: #666666; font-style: italic;">// le service a stopper</span>
&nbsp;
stopService<span style="color: #009900;">&#40;</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>,service.<span style="color: #006633;">getClass</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: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// appel explicite</span>
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">Class</span> serviceClass <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span>service.<span style="color: #006633;">getClassName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
stopService<span style="color: #009900;">&#40;</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>,serviceClass<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<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;">ClassNotFoundException</span> e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>



<p>Related posts:<ol><li><a href='http://www.android-inside.com/2009/11/earthqauke-suite-du-projet-android/' rel='bookmark' title='Earthquake suite du projet android'>Earthquake suite du projet android</a></li>
<li><a href='http://www.android-inside.com/2009/11/travailler-avec-les-preferences-sous-android/' rel='bookmark' title='Travailler avec les preferences sous ANDROID'>Travailler avec les preferences sous ANDROID</a></li>
<li><a href='http://www.android-inside.com/2009/11/projet-android-par-etapes-applications-desearthquake/' rel='bookmark' title='Projet android par etapes : Applications EarthQuake'>Projet android par etapes : Applications EarthQuake</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.android-inside.com/2009/11/services-sous-android-lecon-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
