<?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>Tutoriale Video</title>
	<atom:link href="http://itassistant.org/feed" rel="self" type="application/rss+xml" />
	<link>http://itassistant.org</link>
	<description>Tutoriale Video pentru Windows si Linux &#124; Programare C Java PHP Android</description>
	<lastBuildDate>Fri, 03 Feb 2012 19:34:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Google SketchUp &#8211; Introducere &#8211; Tutorial 1</title>
		<link>http://itassistant.org/grafica/google-sketchup-introducere-tutorial-1.html</link>
		<comments>http://itassistant.org/grafica/google-sketchup-introducere-tutorial-1.html#comments</comments>
		<pubDate>Fri, 03 Feb 2012 19:34:20 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Google SketchUp]]></category>
		<category><![CDATA[Grafica]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Instructor]]></category>
		<category><![CDATA[Measurements]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[SketchUp]]></category>
		<category><![CDATA[tridimensional]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=5005</guid>
		<description><![CDATA[Tutorial video ce prezenta programul de grafică 3D Google SketchUp și modul de lucru cu acest program. Google SketchUp reprezintă un program de modelare tridimensională (3D) cu aplicabilitate în diverse domenii: arhitectură, construcții civile, inginerie mecanică, cinematografie, conceperea de jocuri pentru PC.]]></description>
			<content:encoded><![CDATA[<object width="540" height="360"><param name="movie" value="http://www.youtube.com/v/cXcWRCT30v0?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/cXcWRCT30v0?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="540" height="360" allowscriptaccess="always" allowfullscreen="true"></embed></object><p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/5005&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>	Numele meu este Andrei și începând cu acest tutorial voi prezenta programul de grafică 3D Google <b>SketchUp</b>® și modul de lucru cu acest program.</p>
<p>	În acest prim tutorial am încercat să fac o descriere cât mai succintă a programului (deși durează aproape o oră) și a primilor pași de lucru cu uneltele sale.</p>
<p>	Orice părere de-a voastră este bine venită și sigur va avea un aport constructiv pentru realizarea tutorialelor viitoare, dar țin să menționez că mă aflu la prima experiență în ceea ce privește susținerea fără audiență fizică a unei prezentări educative și sigur este loc de mai bine. În ceea ce privește sunetul din tutorialul video îmi cer scuze și vă rog să aveți grija la volumul sunetului, deoarece exceptând intro-ul și outro-ul sunetul pe durata întregii înregistrări este scăzut.</p>
<p>	În continuare, vizionare/lectură plăcută și vă încurajez să faceți cat mai mult uz de acest <em>soft gratuit</em> care vă va scutii de foarte multe situații neplăcute pe viitor în ceea ce privește  o mare parte din activitățile voastre cotidiene.</p>
<p>(Pentru orice intrebari puteti sa ma gasiti la adresa: <em>stefan.andrei.vet [at] gmail [dot] com</em>)</p>
<h2> Despre Google SketchUp ® </h2>
<p></p>
<p>Google <i>SketchUp</i>® reprezintă un program (softwere) de <strong>modelare tridimensională (3D)</strong> cu aplicabilitate în diverse domenii: arhitectură, construcții civile, inginerie mecanică, cinematografie, conceperea de jocuri pentru PC etc. Programul este realizat în așa fel încât să fie ușor de utilizat, chiar și de persoane care nu au avut tangență cu un astfel de program până la momentul respectiv.</p>
<p>	Proiectele realizate pot fi puse la dispoziția publicului larg, prin plasarea acestora în <strong>Google’s 3D Warehouse®</strong>, un depozit virtual destinat tuturor celor care doresc să-și facă publice lucrăriile.</p>
<p>	De asemenea Google SketchUp® permite amplasarea geografică a proiectelor realizate prin interacțiunea cu <strong>Google Earth®</strong>, proiectele astfel realizate vor putea fi vizualizate în timp real fie cu ajutorul programului <strong>Google Earth®</strong>, fi prin interfața on-line <strong>Google Maps®</strong>.</p>
<h3> 1. Interfața cu utilizatorul (user interface) a programului Google SketchUp® </h3>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Google SketchUp Introducere 1.png" target="_blank"><img src="http://itassistant.org/pics/Google SketchUp Introducere 1.png" alt="Google SketchUp" title="Google SketchUp"/></a>
</div>
<p></p>
<p><strong>1)</strong>	Axele Roșu/Verde/Albastru – o reprezentare mai simpla a axelor x/y/z<br />
<strong>2)</strong>	Bara de meniuri<br />
<strong>3)</strong>	Standard – „bara standard”<br />
<strong>4)</strong>	Large tool set – bara de unelte „mare”<br />
<strong>5)</strong>	Measurements – bara de dialog și de interacționare în ceea ce privește editarea/vizualizarea unităților de măsură<br />
<strong>6)</strong>	Instructor – bara unde se pot vizualiza indicațiile oferite de către program<br />
<strong>7)</strong>	Suprafața de lucru</p>
<h4> 1.1. Axele Roșu/Verde/Albastru </h4>
<p></p>
<p>	<strong>Axele Roșu/Verde/Albastru</strong> sunt reprezentarea mai interactivă a sistemului de coordonate „clasic” <strong>0-X-Y-Z</strong>. Înlocuirea notării clasice cu reprezentarea prin intermediul culorilor (<em>rosu, verde, albastru</em>), se dorește a veni în ajutorul utilizatorului, accesând latura intuitivă a procesului proiectare. Pe parcursul procesului de proiectare aceste axe vor servii ca linii de referință, aspect ce va fi dezvoltat în lecțiile următoare.</p>
<h4> 1.2. Bara de meiuri  </h4>
<p></p>
<p>	Cu ajutorul barei de meniuri putem accesa diferite comenzi prezente în meniurile derulante ce se acționează în momentul când facem clic pe acestea (<em>File, Edit, View, Camera, Draw, Tools, Window, Plugins, Help</em>).</p>
<h4> 1.3. Standard – „bara standard”  </h4>
<p> </p>
<p>	Pe această bară de unelte se găsesc comenzile tipice unui program ce rulează în<strong> MS Windows®</strong> (<em>New, Open, Save, Copy/Cut, Paste, Erase, Undo/Redo, Print, Model Info</em>), iar dacă sistemul de operare este altul (<strong>Linux®, Mac OSX®</strong>) atunci această bară de unelte va corespunde configurației respective.</p>
<h4> 1.4. Large tool set – bara de unelte „mare”  </h4>
<p></p>
<p>	Asemănător altor programe pentru editare grafică (e.g. AutoCAD®) și Google SketchUp® utilizează gruparea uneltelor de lucru și dispunerea acestora pe bare de unelte. Spre deosebire de alte programe uneltele sunt grupate în așa fel încât să fie ușor de accesat, într-o manieră intuitivă. Bara de unelte Large tool set grupează toate elementele generale de editare grafică, spre deosebire de bara de unelte Getting started, care apare implicit in momentul în care rulam programul Google SketchUp® pentru prima oară. </p>
<p>	Orice bară de unelte poate activată/inactivată astfel: <em>Meniul View → Toolbars…</em> .</p>
<h4> 1.5. Measurements  </h4>
<p></p>
<p>	Acest element al ferestrei Google SketchUp® reprezintă mijlocul prin care putem să vizualizăm sau să editam cotele unui element din spațiul de desenare. În ceea ce privește inserarea dimensiunilor unui obiect, după ce am indicat cu ajutorul cursorului primul punct pe spațiul de lucru și am indicat direcția de trasare, putem introduce valoarea numerică a distanței celui de-al doilea punct față de primul. </p>
<p>	Un alt lucru important ce trebuie menționat este acela că între două cote introducem semnul <em>„ , ”</em>, iar în cazul în care lucrăm cu zecimale introducem după numărul întreg semnul <em>„ . ”</em>. De asemenea dacă dorim să utilizăm unități de măsură, altele decât cele setate în prealabil, atunci putem tasta simbolul unității de măsură dorite (<em>m, cm, mm, feet, inch</em>) imediat după valoarea numerică, fără a lăsa spațiu între cele două.</p>
<p>	Ce trebuie reținut este faptul că în Google SketchUp® desenăm la scară reală.</p>
<h4> 1.6. Instructor  </h4>
<p></p>
<p>	În această regiune a ferestrei Google SketchUp®, programul ne oferă indicații privind comenzile care le avem activate la momentul respectiv, oferindu-ne și opțiuni secundare ale acestora prin indicarea tastelor sau grupurilor de taste corespunzătoare.</p>
<h4> 1.7. Suprafața de lucru  </h4>
<p></p>
<p>	Acest spațiu este destinat realizării desenului nostru. Elementele principale și esențiale din acest spațiu sunt reprezentate de cele trei axe: Axa Roșie, Axa Verde și Axa Albastră. Aceste trei axe sunt varianta mai „simplă” a celor trei axe de coordonate <em>OX, OY și OZ</em>. Un alt element ce apare în spațiul de lucru la prima rulare a programului, este silueta umană („<em>Susan</em>”) care ne oferă posibilitatea să ne raportăm elementele desenate la înălțimea standard a unui om.</p>
<h3> 2. Large tool set – bara de unelte „mare” </h3>
<p></p>
<p>Uneltele de desenare din această bară pot fi activate în grupuri din<em> Meniul View → Toolbars…</em>, de asemenea și alte grupuri de unelte care nu se află în bara Large tool set. În continuare vor fi enumerate pe grupuri fiecare comandă din bara <strong>Large tool set</strong>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Google SketchUp Introducere 2.png" target="_blank"><img src="http://itassistant.org/pics/Google SketchUp Introducere 2.png" alt="Google SketchUp" title="Google SketchUp"/></a>
</div>
<p></p>
<p><strong>Large tool set</strong></p>
<p><strong>•	Principal:</strong></p>
<ul>
<li><strong>Select</strong> – permite selectarea unui element desenat (o față, o dreaptă, un segment, un grup, o componentă)</li>
<li><strong>Make Component</strong> – permite transformarea unei entități desenate într-o componentă (Component)</li>
<li><strong>Paint Bucket</strong> – la lansarea acestei comenzi se va deschide o fereastră ce permite alegerea unei texturi pe care apoi o atribuim unei suprafețe</li>
<li><strong>Eraser</strong> – cu ajutorul acestei unelte putem elimina entități prin selectare individuală sau prin selectare multiplă (se menține activată comanda și se trece cursorul peste elementul de șters)</li>
</ul>
<p><strong>•	Drawing:</strong></p>
<ul>
<li><strong>Line/Pencil Tool</strong> – permite trasarea linilor de dreaptă sau prin închiderea unui perimetru se realizează marginile unei suprafețe</li>
<li><strong>Arc</strong> – permite trasarea unui arc de cerc, prin indicarea unui punct de început, a unui punct final și a razei arcului de cerc</li>
<li><strong>Freehand</strong> – cu această unealtă se realizează linii „trasate manual”. Dacă linia se închide în punctul de pornire se va delimita astfel și o față</li>
<li><strong>Rectangle</strong> – prin indicarea unui punct de început și a unui punct de încheiere  pe diagonală, se va trasa un dreptunghi</li>
<li><strong>Circle</strong> – prin indicarea unui centru de cerc și a razei acestuia se va trasa un cerc</li>
<li><strong>Polygon</strong> – se introduce în bara Measurements numărul de laturi ale poligonului, se indică centrul poligonului, iar apoi raza poligonului</li>
</ul>
<p><strong>•	Modification:</strong></p>
<ul>
<li><strong>Move</strong> – cu această unealtă se pot muta, copia și/sau întinde („strech”) entități. De asemenea cu această unealtă se pot modifica și suprafețe prin repoziționarea uneia/unor laturi</li>
<li><strong>Push/Pull</strong> – cu această unealtă împingem sau tragem de fețele unui obiect desenat pentru a adăuga sau a elimina volum obiectului respectiv</li>
<li><strong>Rotate</strong> – permite rotirea, întinderea, distorsionarea sau copiere urmărind un traseu circular</li>
<li><strong>Follow Me</strong> – multiplică o față de lungul unui traseu</li>
<li><strong>Scale</strong> – permite redimensionarea și întinderea unei porțiuni al unei figuri geometrice prin raportarea la un alt obiect</li>
<li><strong>Offset</strong> – permite crearea unor copii de linii la o distanță uniformă de original</li>
</ul>
<p><strong>•	Construction:</strong></p>
<ul>
<li><strong>Tape Measure/Ruleta</strong> – permite măsurarea distanțelor, crearea liniilor și/sau a punctelor de ghidare, sau redimensionarea unui model</li>
<li><strong>Dimension</strong> – permite inserarea cotelor entităților desenate</li>
<li><strong>Protractor</strong> – permite măsurarea unghiurilor și crearea de linii de construcție la diferite unghiuri</li>
<li><strong>Text</strong> – permite inserarea de text</li>
<li><strong>Axes</strong> – permite mutarea sau reorientarea axelor de desenare</li>
<li><strong>3D Text</strong> – la acționarea comenzii va apărea o fereastra unde se va edita și apoi plasa în desen un text tridimensional (acest text va acea proprietățile unei componente)</li>
</ul>
<p><strong>•	Camera:</strong></p>
<ul>
<li><strong>Orbit</strong> – permite rotirea perspectivei de vizualizare în raport cu modelul</li>
<li><strong>Pan</strong> – permite modificarea poziției perspectivei de vizualizare a utilizatorului, pe verticală sau pe orizontala</li>
<li><strong>Zoom</strong> – permite mărirea sau micșorarea perspectivei de vizualizare (zoom in și zoom out)</li>
<li><strong>Previous</strong> – revine la modul/-urile de vizualizare anterior/-oare</li>
<li><strong>Next</strong> – trece la modul/-urile de vizualizare urmator/-oare</li>
<li><strong>Zoom extents</strong> – încadrează întregul desen în spațiul de desenare</li>
</ul>
<p><strong>•	Walkthrough:</strong></p>
<ul>
<li><strong>Position Camera</strong> – permite poziționarea perspectivei de vizualizare (perspectiva utilizatorului) la o înălțime indicată pentru a verifica o anumită perspectivă sau pentru a pășii în/pe lângă obiectul desenat</li>
<li><strong>Walk</strong> – permite „plimbarea” prin/pe lângă obiectul desenat</li>
<li><strong>Look Around </strong>– pivotarea perspectivei de vizualizare printr-un punct fix</li>
<li><strong>Section Plane</strong> – permite crearea unor planuri de secțiune</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/grafica/google-sketchup-introducere-tutorial-1.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Invata Sistemul de Operare Android &#8211; Partea 10</title>
		<link>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-10.html</link>
		<comments>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-10.html#comments</comments>
		<pubDate>Sun, 29 Jan 2012 10:05:27 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Activity]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[externa]]></category>
		<category><![CDATA[interna]]></category>
		<category><![CDATA[SD Card]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[stocare]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4952</guid>
		<description><![CDATA[Invata Sistemul de Operare Android - Partea 10 - serie de tutoriale isi propune sa va familiarizeze cu Sistemul de Operare Android astfel incat sa puteti sa scrieti singuri aplicatii pentru propriul SmartPhone.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4952.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe ItAssistant. Aceasta noua serie de tutoriale isi propune sa va familiarizeze cu <strong>Sistemul de Operare Android </strong>astfel incat sa puteti sa scrieti singuri <em>aplicatii </em>pentru propriul <strong>SmartPhone</strong>, si de ce nu, aplicatia sa ajunga in top pe <a target="_blank" href="https://market.android.com/" title="Android Market" target="_blank" rel="nofollow"><i>Android</i> Market</a>.</p>
<p>Inainte de a incepe trebuie sa cunoasteti destul de bine limbajul de programare <strong>Java </strong>si conceptele <strong>Programarii Orientata Obiect</strong>; puteti sa aruncati o privire peste tutorialele noastre avansate: <a href="http://itassistant.org/programare/java-programare" title="Invata Java" target="_blank">Invata Java</a></p>
<h2> Android &#8211; Stocarea Datelor </h2>
<p></p>
<p>In Android exista mai multe moduri in care puteti sa stocati datele:</p>
<ul>
<li><strong>Shared Preferences</strong> &#8211; stocheaza doar date in forma key-value (datele care sunt salvate pot fi de tipul: String, boolean, float, int, long)</li>
<li><strong>Stocare interna</strong> &#8211; folosirea memorie device-ului</li>
<li><strong>Stocare externa</strong> &#8211; folosirea unui dispozitiv extern, de obicei un<em> SD Card</em>.</li>
<li><strong>Baza de date</strong> &#8211; folosirea unei baze de date <em>SQLite</em></li>
</ul>
<p>Puteti de asemenea sa aveti deja date predefinite, dar cand <em>Read Only</em>. Acestea se pot gasi in:</p>
<ul>
<li>directorul <strong>Assets</strong></li>
<li>directorul <strong>res/raw</strong></li>
</ul>
<h3> Android &#8211; Stocare interna </h3>
<p></p>
<p>Exemplu de stocare a datelor intr-un fisier.</p>
<p><em>EditorApp.java</em></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Button</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.EditText</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Toast</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.OutputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.OutputStreamWriter</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EditorApp <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> NOTES<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;notes.txt&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> EditText editor<span style="color: #339933;">;</span>
	<span style="color: #003399;">Button</span> btn<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @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>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <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>
        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>
&nbsp;
        editor <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EditText<span style="color: #009900;">&#41;</span>findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">editor</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        btn <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;">close</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        btn.<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;">Button</span>.<span style="color: #006633;">OnClickListener</span><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;">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>
        		finish<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        	<span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onResume<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;">super</span>.<span style="color: #006633;">onResume</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	    	<span style="color: #003399;">InputStream</span> in <span style="color: #339933;">=</span> openFileInput<span style="color: #009900;">&#40;</span>NOTES<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>in <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>
		    	<span style="color: #003399;">InputStreamReader</span> tmp <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>in<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    	<span style="color: #003399;">BufferedReader</span> reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    	<span style="color: #003399;">String</span> str<span style="color: #339933;">;</span>
&nbsp;
		    	<span style="color: #003399;">StringBuffer</span> buf <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		    	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>str <span style="color: #339933;">=</span> reader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <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>
		    		buf.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>str<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    	<span style="color: #009900;">&#125;</span>
		    	in.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		    	editor.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>buf.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><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: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>java.<span style="color: #006633;">io</span>.<span style="color: #003399;">FileNotFoundException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    		<span style="color: #666666; font-style: italic;">// that's OK, we probably haven't created it yet</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;">Throwable</span> t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	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: #0000ff;">&quot;Exception: &quot;</span> <span style="color: #339933;">+</span> t.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">2000</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>
    	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onPause<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;">super</span>.<span style="color: #006633;">onPause</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	    	<span style="color: #003399;">OutputStreamWriter</span> out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">OutputStreamWriter</span><span style="color: #009900;">&#40;</span>openFileOutput<span style="color: #009900;">&#40;</span>NOTES, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	out.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>editor.<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><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	out.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</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;">Throwable</span> t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	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: #0000ff;">&quot;Exception: &quot;</span> <span style="color: #339933;">+</span> t.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">2000</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>
    	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><em>main.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #339933;">?&gt;</span>
<span style="color: #339933;">&lt;</span>LinearLayout xmlns<span style="color: #339933;">:</span>android<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://schemas.android.com/apk/res/android&quot;</span>
    android<span style="color: #339933;">:</span>orientation<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;vertical&quot;</span>
    android<span style="color: #339933;">:</span>layout_width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fill_parent&quot;</span>
    android<span style="color: #339933;">:</span>layout_height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fill_parent&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
	<span style="color: #339933;">&lt;</span>Button android<span style="color: #339933;">:</span>id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;@+id/close&quot;</span>
		android<span style="color: #339933;">:</span>layout_width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fill_parent&quot;</span>
		android<span style="color: #339933;">:</span>layout_height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;wrap_content&quot;</span>
		android<span style="color: #339933;">:</span>text<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Close&quot;</span> <span style="color: #339933;">/&gt;</span>
	<span style="color: #339933;">&lt;</span>EditText
		android<span style="color: #339933;">:</span>id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;@+id/editor&quot;</span>
		android<span style="color: #339933;">:</span>layout_width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fill_parent&quot;</span>
		android<span style="color: #339933;">:</span>layout_height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fill_parent&quot;</span>
		android<span style="color: #339933;">:</span>singleLine<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;false&quot;</span><span style="color: #339933;">/&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>LinearLayout<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Dupa cum observati aplicatia are si un buton <strong>Close</strong> folosit pentru a incheia activitatea cu ajutorul functiei <em>finish()</em>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_Stocare_Interna.png" target="_blank"><img src="http://itassistant.org/pics/Android_Stocare_Interna.png" alt="Android Stocare Interna" title="Android Stocare Interna"/></a>
</div>
<p></p>
<h3> Android &#8211; Stocare externa </h3>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_Stocare_Externa.png" target="_blank"><img src="http://itassistant.org/pics/Android_Stocare_Externa.png" alt="Android Stocare Externa" title="Android Stocare Externa"/></a>
</div>
<p></p>
<p>Pentru a afla calea catre dispozitivul extern va trebui sa folositi functia <em>getExternalStorageDirectory()</em>. Exemplu:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> path <span style="color: #339933;">=</span> <span style="color: #003399;">Environment</span>.<span style="color: #006633;">getExternalStorageDirectory</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><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> filePath <span style="color: #339933;">=</span> path <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;fisierulMeu.txt&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">InputStream</span> input <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileInputStream</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span> <span style="color: #009900;">&#40;</span>filePath<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Un <strong>good practice</strong> este sa verificati inainte ca puteti sa cititi/scrieti pe un dispozitiv extern. Un exemplu de cod ar fi:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">boolean</span> mExternalStorageAvailable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">boolean</span> mExternalStorageWriteable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> state <span style="color: #339933;">=</span> <span style="color: #003399;">Environment</span>.<span style="color: #006633;">getExternalStorageState</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Environment</span>.<span style="color: #006633;">MEDIA_MOUNTED</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>state<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// We can read and write the media</span>
    mExternalStorageAvailable <span style="color: #339933;">=</span> mExternalStorageWriteable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Environment</span>.<span style="color: #006633;">MEDIA_MOUNTED_READ_ONLY</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>state<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// We can only read the media</span>
    mExternalStorageAvailable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    mExternalStorageWriteable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Something else is wrong. It may be one of many other states, but all we need</span>
    <span style="color: #666666; font-style: italic;">//  to know is we can neither read nor write</span>
    mExternalStorageAvailable <span style="color: #339933;">=</span> mExternalStorageWriteable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3> Link-uri utile </h3>
<p></p>
<ul>
<li><a target="_blank" href="http://developer.android.com/guide/topics/data/data-storage.html" title="Android Data Storage" target="_blank" rel="nofollow">developer.android.com</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-10.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invata Sistemul de Operare Android &#8211; Partea 9</title>
		<link>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-9.html</link>
		<comments>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-9.html#comments</comments>
		<pubDate>Sun, 29 Jan 2012 09:30:03 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Activity]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[Shared Preferences]]></category>
		<category><![CDATA[stocare]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4951</guid>
		<description><![CDATA[Invata Sistemul de Operare Android - Partea 9 - serie de tutoriale isi propune sa va familiarizeze cu Sistemul de Operare Android astfel incat sa puteti sa scrieti singuri aplicatii pentru propriul SmartPhone.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4951.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe ItAssistant. Aceasta noua serie de tutoriale isi propune sa va familiarizeze cu <strong>Sistemul de Operare Android </strong>astfel incat sa puteti sa scrieti singuri <em>aplicatii </em>pentru propriul <strong>SmartPhone</strong>, si de ce nu, aplicatia sa ajunga in top pe <a target="_blank" href="https://market.android.com/" title="Android Market" target="_blank" rel="nofollow"><i>Android</i> Market</a>.</p>
<p>Inainte de a incepe trebuie sa cunoasteti destul de bine limbajul de programare <strong>Java </strong>si conceptele <strong>Programarii Orientata Obiect</strong>; puteti sa aruncati o privire peste tutorialele noastre avansate: <a href="http://itassistant.org/programare/java-programare" title="Invata Java" target="_blank">Invata Java</a></p>
<h2> Android &#8211; Stocarea Datelor </h2>
<p></p>
<p>In Android exista mai multe moduri in care puteti sa stocati datele:</p>
<ul>
<li><strong>Shared Preferences</strong> &#8211; stocheaza doar date in forma key-value (datele care sunt salvate pot fi de tipul: String, boolean, float, int, long)</li>
<li><strong>Stocare interna</strong> &#8211; folosirea memorie device-ului</li>
<li><strong>Stocare externa</strong> &#8211; folosirea unui dispozitiv extern, de obicei un<em> SD Card</em>.</li>
<li><strong>Baza de date</strong> &#8211; folosirea unei baze de date <em>SQLite</em></li>
</ul>
<p>Puteti de asemenea sa aveti deja date predefinite, dar cand <em>Read Only</em>. Acestea se pot gasi in:</p>
<ul>
<li>directorul <strong>Assets</strong></li>
<li>directorul <strong>res/raw</strong></li>
</ul>
<h3> Android &#8211; Shared Preferences </h3>
<p></p>
<p>Exemplu de salvare/restaurare a unei date folosind <strong>Shared Preferences</strong></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> Example <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> PREFS_NAME <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;MyPrefsFile&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle state<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>state<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       . . .
&nbsp;
       <span style="color: #666666; font-style: italic;">// Restore preferences</span>
       SharedPreferences settings <span style="color: #339933;">=</span> getSharedPreferences<span style="color: #009900;">&#40;</span>PREFS_NAME, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #000066; font-weight: bold;">boolean</span> silent <span style="color: #339933;">=</span> settings.<span style="color: #006633;">getBoolean</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;silentMode&quot;</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       setSilent<span style="color: #009900;">&#40;</span>silent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onStop<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;">super</span>.<span style="color: #006633;">onStop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// We need an Editor object to make preference changes.</span>
      SharedPreferences settings <span style="color: #339933;">=</span> getSharedPreferences<span style="color: #009900;">&#40;</span>PREFS_NAME, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      SharedPreferences.<span style="color: #006633;">Editor</span> editor <span style="color: #339933;">=</span> settings.<span style="color: #006633;">edit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      editor.<span style="color: #006633;">putBoolean</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;silentMode&quot;</span>, mSilentMode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// Commit the edits!</span>
      editor.<span style="color: #006633;">commit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Exemplu complet de utilizare <strong>PreferenceActivity</strong></p>
<p><em>PreferenceActivityEx.java</em></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.preference.PreferenceActivity</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PreferenceActivityEx <span style="color: #000000; font-weight: bold;">extends</span> PreferenceActivity <span style="color: #009900;">&#123;</span>
    <span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @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>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <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>
        addPreferencesFromResource<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">settings</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><em>PrefActivity.java</em></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Intent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.SharedPreferences</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.preference.PreferenceManager</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View.OnClickListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Button</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PrefActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity<span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">Button</span> settings<span style="color: #339933;">;</span>
	TextView name<span style="color: #339933;">;</span>
	TextView student<span style="color: #339933;">;</span>
	TextView year<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @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>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <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>
        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>
&nbsp;
        settings <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;">button1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        name <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;">textView4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        student <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;">textView5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        year <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;">textView6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        settings.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			@Override
			<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>
				<span style="color: #666666; font-style: italic;">// construim un Intent</span>
		        Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		        <span style="color: #666666; font-style: italic;">// setam componenta de destinatie (activitatea implmentata in clasa ActivitateDePornit)</span>
		        intent.<span style="color: #006633;">setClass</span><span style="color: #009900;">&#40;</span>PrefActivity.<span style="color: #000000; font-weight: bold;">this</span>, PreferenceActivityEx.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		        startActivity<span style="color: #009900;">&#40;</span>intent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        SharedPreferences pref <span style="color: #339933;">=</span> PreferenceManager.<span style="color: #006633;">getDefaultSharedPreferences</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>
        name.<span style="color: #006633;">setText</span> <span style="color: #009900;">&#40;</span>pref.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span>, <span style="color: #0000ff;">&quot;(no name)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>pref.<span style="color: #006633;">getBoolean</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;student&quot;</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
        	student.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;yes&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">else</span>
        	student.<span style="color: #006633;">setText</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;no&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        year.<span style="color: #006633;">setText</span> <span style="color: #009900;">&#40;</span>pref.<span style="color: #006633;">getString</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;year&quot;</span>, <span style="color: #0000ff;">&quot;0&quot;</span><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: #009900;">&#125;</span></pre></div></div>

<p><em>AndroidManifest.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">package</span>=<span style="color: #ff0000;">&quot;com.jupiter.preferenceactivityex&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:versionCode</span>=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:versionName</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-sdk</span> <span style="color: #000066;">android:minSdkVersion</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/icon&quot;</span> <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.PrefActivity&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.action.MAIN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.category.LAUNCHER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.PreferenceActivityEx&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;Config Settings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><em>main.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;AbsoluteLayout</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/absoluteLayout1&quot;</span> </span>
<span style="color: #009900;">    	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span> </span>
<span style="color: #009900;">    	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span> </span>
<span style="color: #009900;">    	<span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;37dip&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;Name:&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textView1&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;50px&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;33dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;36dip&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;Year:&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textView3&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;50px&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;105dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;Student:&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textView2&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;50px&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;36dip&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;66dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span> <span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;109dip&quot;</span> 	</span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;Settings&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/button1&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;196dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Button<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;170dip&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textView4&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;33dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textView5&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;170dip&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;64dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:layout_x</span>=<span style="color: #ff0000;">&quot;170dip&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textView6&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> </span>
<span style="color: #009900;">        	<span style="color: #000066;">android:layout_y</span>=<span style="color: #ff0000;">&quot;97dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/AbsoluteLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><em>array.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string-array</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;years&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>First<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Second<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Third<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Forth<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string-array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string-array</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;years_values&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string-array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><em>settings.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PreferenceScreen</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PreferenceCategory</span> <span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;Person&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;EditTextPreference</span> <span style="color: #000066;">android:key</span>=<span style="color: #ff0000;">&quot;name&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;Name&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:summary</span>=<span style="color: #ff0000;">&quot;Enter your name&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:defaultValue</span>=<span style="color: #ff0000;">&quot;(no name)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PreferenceCategory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PreferenceCategory</span> <span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;Education&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CheckBoxPreference</span> <span style="color: #000066;">android:key</span>=<span style="color: #ff0000;">&quot;student&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;Student&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:defaultValue</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android.summary</span>=<span style="color: #ff0000;">&quot;Are you a student?&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ListPreference</span> <span style="color: #000066;">android:key</span>=<span style="color: #ff0000;">&quot;year&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;Year&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android.defaultValue</span>=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android.summary</span>=<span style="color: #ff0000;">&quot;In which year of study?&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:entries</span>=<span style="color: #ff0000;">&quot;@array/years&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">android:entryValues</span>=<span style="color: #ff0000;">&quot;@array/years_values&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>		
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PreferenceCategory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PreferenceScreen<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_PreferenceActivity1.png" target="_blank"><img src="http://itassistant.org/pics/Android_PreferenceActivity1.png" alt="Android Shared Preferences" title="Android Shared Preferences"/></a>
</div>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_PreferenceActivity2.png" target="_blank"><img src="http://itassistant.org/pics/Android_PreferenceActivity2.png" alt="Android Shared Preferences" title="Android Shared Preferences"/></a>
</div>
<p></p>
<h3> Link-uri utile </h3>
<p></p>
<ul>
<li><a target="_blank" href="http://developer.android.com/guide/topics/data/data-storage.html" title="Android Data Storage" target="_blank" rel="nofollow">developer.android.com</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-9.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aplicatii Android &#8211; Advanced Task Killer</title>
		<link>http://itassistant.org/diverse/aplicatii-android-advanced-task-killer.html</link>
		<comments>http://itassistant.org/diverse/aplicatii-android-advanced-task-killer.html#comments</comments>
		<pubDate>Sat, 28 Jan 2012 11:09:49 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Diverse]]></category>
		<category><![CDATA[Advanced Task Killer]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Market]]></category>
		<category><![CDATA[configurare]]></category>
		<category><![CDATA[instalare]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4939</guid>
		<description><![CDATA[Tutorial ce prezinta aplicatia Android - Advanced Task Killer, care va prelungi viata bateriei telefonului.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4939.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salut,bine ati venit pe itassistant.org, eu sunt Razvan si vreau sa inaugurez o noua serie de tutoriale, si anume <strong>aplicatii folositoare pentru Android</strong>.</p>
<p>Prima aplicatie pe care vreau sa o prezint este &#8220;<strong>Advanced Task Killer</strong>&#8220;, o aplicatie care ne inchide restul aplicatiilor pentru ca bateria sa aiba o durata mai lunga.</p>
<h2> Instalare Android &#8211; Advanced Task Killer </h2>
<p></p>
<p>Sa incepem, aplicatia este gratuita in &#8220;<strong>Android Market</strong>&#8220;, scriem in casuta de cautare &#8220;<strong>advanced task killer</strong>&#8221; si aplicatia este primul rezultat:</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Advanced Task Killer 1.png" target="_blank"><img src="http://itassistant.org/pics/Advanced Task Killer 1.png" alt="Aplicatii Android - Advanced Task Killer" title="Aplicatii Android - Advanced Task Killer"/></a>
</div>
<p></p>
<p>Dupa instalare deschidem aplicatia pentru a o configura.</p>
<h3> Configurare Android &#8211; Advanced Task Killer </h3>
<p></p>
<p>Dupa ce am intrat in aplicatie apasam pe butonul &#8220;<em>Meniu</em>&#8221; (al telefonului), si mergem la setari. Bifam &#8220;<em>Auto start</em>&#8221; </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Advanced Task Killer 2.png" target="_blank"><img src="http://itassistant.org/pics/Advanced Task Killer 2.png" alt="Aplicatii Android - Advanced Task Killer" title="Aplicatii Android - Advanced Task Killer"/></a>
</div>
<p></p>
<p>Navigam la tag-ul &#8220;<strong>Auto Kill</strong>&#8221; </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Advanced Task Killer 3.png" target="_blank"><img src="http://itassistant.org/pics/Advanced Task Killer 3.png" alt="Aplicatii Android - Advanced Task Killer" title="Aplicatii Android - Advanced Task Killer"/></a>
</div>
<p></p>
<p>Si de acolo intram in meniul &#8220;<strong>Auto Kill Level</strong>&#8221; si bifam &#8220;<strong>Crazy</strong>&#8220;</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Advanced Task Killer 4.png" target="_blank"><img src="http://itassistant.org/pics/Advanced Task Killer 4.png" alt="Aplicatii Android - Advanced Task Killer" title="Aplicatii Android - Advanced Task Killer"/></a>
</div>
<p></p>
<p>Din meniul anterior intram si in &#8220;<strong>Auto Kill Frequency</strong>&#8221; si bifam &#8220;<strong>When screen off</strong>&#8221; </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Advanced Task Killer 5.png" target="_blank"><img src="http://itassistant.org/pics/Advanced Task Killer 5.png" alt="Aplicatii Android - Advanced Task Killer" title="Aplicatii Android - Advanced Task Killer"/></a>
</div>
<p></p>
<p>Acum toate aplicatiile se vor inchide atunci cand ecranul se va stinge iar viata bateriei telefonului vostru va fi prelungita!</p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/diverse/aplicatii-android-advanced-task-killer.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cinema 4d interfata si unelte &#8211; Partea 2</title>
		<link>http://itassistant.org/grafica/cinema-4d-interfata-si-unelte-partea-2.html</link>
		<comments>http://itassistant.org/grafica/cinema-4d-interfata-si-unelte-partea-2.html#comments</comments>
		<pubDate>Sat, 28 Jan 2012 09:51:59 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Grafica]]></category>
		<category><![CDATA[4d]]></category>
		<category><![CDATA[animatie tridimensionala]]></category>
		<category><![CDATA[cinema]]></category>
		<category><![CDATA[grafica]]></category>
		<category><![CDATA[interfata]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unelete]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4913</guid>
		<description><![CDATA[Tutorial video ce prezinta un soft de grafica si animatie tridimensionala - Cinema 4d - interfata si unelte - Partea 2]]></description>
			<content:encoded><![CDATA[<object width="540" height="360"><param name="movie" value="http://www.youtube.com/v/FjucfQE_QFE?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/FjucfQE_QFE?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="540" height="360" allowscriptaccess="always" allowfullscreen="true"></embed></object><p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4913.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salutari si bine ati venit pe itassistant.org eu sunt Mihai si sunt aici pentru a va inveseli ziua cu un nou tutorial de <strong>grafica si animatie in cinema 4d</strong> in care vom vorbi mai in amanunt depre <em>interfata</em> programului cu <em>functiile</em> si <em>uneltele</em> pe care le detine acesta.</p>
<h2> Cinema 4d &#8211; View </h2>
<p></p>
<p>Sa incepem cu View-urile. Ce sunt view-urile? Pai un view este un elemnt de BAZA al orcarui pachet tridimensional, in el putem vedea si manipula efectiv obiectele create. </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_1.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_1.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
<p><i>Cinema</i> 4d dispune de 4 view-uri, ele sunt: </p>
<ul>
<li><strong>perspecti</strong> (vedem obiectul din perspectiva)</li>
<li><strong>top</strong> (vedem obiectul de sus)</li>
<li><strong>right</strong> (vedem obiectul din dreapta)</li>
<li><strong>front</strong> (vedem obiectul din fata)</li>
</ul>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_2.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_2.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
<p>Obiectele le putem crea din acest panou cat si <em>spline-urile</em> (sunt diferite modalitati de a trasa linii astfel sa  ajungem la obiecte mai complexe sau sa stabilim tractoria unui obiect in miscare), <em>nurb-urile</em> (diverse efecte care se aplica pe obiecte si spline-uri), <em>conectorii</em> (sunt proprietati de interactione ale obiectelor intre ele), <em>deformatorii</em> (cu ei putem deforma obiectele in diferite pozitii), luminile si bakgroundul si simulatoarele (ele ne ajuta in animatie sa simulam diverse efecte, ex: un simulatoor de particule ne ajuta sa cream foc ). </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_3.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_3.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
<p>Toate <em>obiectele, spline-urile, narb-urile, conectorii, deformatorii sau simulatoarele</em> ne sunt afistate sub forma de lista  (asezate erarhic) in <strong>object manager</strong>. Pentru ca acestea sa ineractioneze trebuie sa cream ierarhii cu ele.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_4.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_4.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
<p>Sub <strong>object manager</strong> gasim <strong>attributes maneger</strong> de unde putem controla diferitele atribute ale obiectelor si nu numai.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_5.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_5.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
<p>Putem modifica obictele create modificatnd valori din<strong> attributes manager</strong>, sau folosind uneletele de<em> move, scale si rotate</em> pentru a muta redimensiona respectiv roti obiectul:</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_6.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_6.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p> </p>
<p>Pentru a putea modela obiectul in functie de segmente trebuie mai intai sa il convertim intr-un obiect editatbil, putem face asta selectand obiectul si apasand tasta &#8220;<em>C</em>&#8220;. Apoi cu una din uneltele de selectie:</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_7.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_7.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
<p>Putem selecta<em> puncte, laturi, sau polgoane</em>, in functie de optiunea de selectia pe care o folositi (ele se pot selecta din panoul din stanga view-ului).</p>
<p>In parte de jos a programului putem observa un <strong>timeline</strong>, el este instrumentul principal atunci cand cream o animatie deoarece cu el putem controla in timp obictele.</p>
<p>Sub timeline gasim <strong>managerul de materiale</strong>. Materialele sunt cele care creaza &#8220;invelisul obiectelor&#8221;, creand un material pentru un obiect ii determinam <em>culoare, transparenta, luminozitatea,</em> etc. </p>
<p>Putem crea materiale dand dublu clic in <strong>managerul de materiale</strong>. Ca sa editam noul material creat putem sa o facem din <strong>attributes manager</strong>, sau dand dublu clic pe noul materia si ni se va deschide o fereastra din care putem edita mai complex materialul.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D_ep2_8.PNG" target="_blank"><img src="http://itassistant.org/pics/Cinema4D_ep2_8.PNG" alt="Cinema 4d interfata si unelte" title="Cinema 4d interfata si unelte"/></a>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/grafica/cinema-4d-interfata-si-unelte-partea-2.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Invata Sistemul de Operare Android &#8211; Partea 8</title>
		<link>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-8.html</link>
		<comments>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-8.html#comments</comments>
		<pubDate>Sat, 21 Jan 2012 13:15:21 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Activity]]></category>
		<category><![CDATA[meniu]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4750</guid>
		<description><![CDATA[Invata Sistemul de Operare Android - Partea 8 - serie de tutoriale isi propune sa va familiarizeze cu Sistemul de Operare Android astfel incat sa puteti sa scrieti singuri aplicatii pentru propriul SmartPhone.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4750.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe ItAssistant. Aceasta noua serie de tutoriale isi propune sa va familiarizeze cu <strong>Sistemul de Operare Android </strong>astfel incat sa puteti sa scrieti singuri <em>aplicatii </em>pentru propriul <strong>SmartPhone</strong>, si de ce nu, aplicatia sa ajunga in top pe <a target="_blank" href="https://market.android.com/" title="Android Market" target="_blank" rel="nofollow">Android Market</a>.</p>
<p>Inainte de a incepe trebuie sa cunoasteti destul de bine limbajul de programare <strong>Java </strong>si conceptele <strong>Programarii Orientata Obiect</strong>; puteti sa aruncati o privire peste tutorialele noastre avansate: <a href="http://itassistant.org/programare/java-programare" title="Invata Java" target="_blank">Invata Java</a></p>
<h2> Android &#8211; Meniuri </h2>
<p></p>
<p><strong>Meniurile</strong> sunt o parte importanta din interfata grafica a unei aplicatii, ele oferind posibilitatea utilizatorului de a accesa rapid actiuni comune (de exemplu in aplicatia pentru email sincronizarea inbox-ului).</p>
<p>Mai jos este prezentat <strong>meniul din Browser-ul Android</strong>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_Menu_1.png" target="_blank"><img src="http://itassistant.org/pics/Android_Menu_1.png" alt="Android Meniu" title="Android Meniu"/></a>
</div>
<p></p>
<p>Este recomandat ca meniul sa fie declarat intr-un fisier <strong>XML</strong>. Aceste trebuie sa se gaseasca in: <em>res/menu/</em>. Mai jos este prezentat un astfel de fisier.</p>
<p><em>menu.options_menu.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/dashboard_refresh&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;@string/dashboard_refresh&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/refresh&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/dashboard_settings&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;@string/dashboard_settings&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@android:drawable/ic_menu_preferences&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/dashboard_about&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;@string/dashboard_about&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/about&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/dashboard_help&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:title</span>=<span style="color: #ff0000;">&quot;@string/dashboard_help&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/help&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/menu<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>Observatii</strong>:</p>
<ul>
<li>fiecare element al meniului este declarat in tag-ul &lt;item&gt;</li>
<li>id-ul elementului este declarat in atributul <strong>android:id</strong></li>
<li>textul este declarat in atributul <strong>android:title</strong> (este o practica buna ca string-urile sa fie externalizate in fisierul <em>string.xml</em>)</li>
<li>fiecare element poate avea si o imagine; aceste imagini pot fi ale sistemului, caz in care vom folosi <em>android:icon=&#8221;@android:drawable/nume_imagine&#8221;</em> sau incarcate de programator in folderul <em>/res/drawable/</em>, caz in care vor fi referite astfel: <em>android:icon=&#8221;@drawable/help&#8221;</em> (este de preferat ca imaginile pe care le folosit in aplicatiile voastre sa fie <strong>PNG</strong>)</li>
</ul>
<p>Mai jos este prezentat si fisierul string.xml</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;hello&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Hello World, MenuExampleActivity!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>MenuExample<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #808080; font-style: italic;">&lt;!-- The menu entry for dashboard --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dashboard_refresh&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Sync<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dashboard_settings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Settings<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dashboard_about&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>About<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dashboard_help&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Help<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Incarcarea unui meniu intr-o Activitate se face utilizand functia <em>MenuInflater.inflate()</em> in timpul executiei <em>onCreateOptionsMenu()</em> (acesta functie va trebui suprascrisa).</p>
<h3> Exemplu Android Meniu </h3>
<p></p>
<p>In continuare este prezentata o <strong>Activitate</strong> care incarca meniul declarat anterior si afiseaza un mesaj (<strong>Toast</strong>) in momentul in care user-ul actioneaza un element.</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;">org.menuexample</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.Menu</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.MenuInflater</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.MenuItem</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Toast</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MenuExampleActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
    <span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @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>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <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>
        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>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">/*
	 * Create Menu Option
	 * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
	 */</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onCreateOptionsMenu<span style="color: #009900;">&#40;</span><span style="color: #003399;">Menu</span> menu<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		MenuInflater inflater <span style="color: #339933;">=</span> getMenuInflater<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		inflater.<span style="color: #006633;">inflate</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">menu</span>.<span style="color: #006633;">options_menu</span>, menu<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*
	 * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
	 */</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onOptionsItemSelected<span style="color: #009900;">&#40;</span><span style="color: #003399;">MenuItem</span> item<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>item.<span style="color: #006633;">getItemId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">case</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">dashboard_refresh</span><span style="color: #339933;">:</span>
			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: #0000ff;">&quot;Sync&quot;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</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>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">case</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">dashboard_settings</span><span style="color: #339933;">:</span>
			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: #0000ff;">&quot;Settings&quot;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</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>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">case</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">dashboard_about</span><span style="color: #339933;">:</span>
			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: #0000ff;">&quot;About&quot;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</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>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">case</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">dashboard_help</span><span style="color: #339933;">:</span>
			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: #0000ff;">&quot;Help&quot;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</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>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Dupa cum observati din exemplu de mai sus, pentru a raspunde la actiunile user-ului va trebui suprascrisa functia <em>onOptionsItemSelected()</em></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_Menu_2.png" target="_blank"><img src="http://itassistant.org/pics/Android_Menu_2.png" alt="Android Meniu" title="Android Meniu"/></a>
</div>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Android_Menu_3.png" target="_blank"><img src="http://itassistant.org/pics/Android_Menu_3.png" alt="Android Meniu" title="Android Meniu"/></a>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-8.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invata Sistemul de Operare Android &#8211; Partea 7</title>
		<link>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-7.html</link>
		<comments>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-7.html#comments</comments>
		<pubDate>Sat, 21 Jan 2012 12:49:11 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[Activity]]></category>
		<category><![CDATA[componente]]></category>
		<category><![CDATA[filtre]]></category>
		<category><![CDATA[intents]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4749</guid>
		<description><![CDATA[Invata Sistemul de Operare Android - Partea 7 - serie de tutoriale isi propune sa va familiarizeze cu Sistemul de Operare Android astfel incat sa puteti sa scrieti singuri aplicatii pentru propriul SmartPhone.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4749.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe ItAssistant. Aceasta noua serie de tutoriale isi propune sa va familiarizeze cu <strong>Sistemul de Operare Android </strong>astfel incat sa puteti sa scrieti singuri <em>aplicatii </em>pentru propriul <strong>SmartPhone</strong>, si de ce nu, aplicatia sa ajunga in top pe <a target="_blank" href="https://market.android.com/" title="Android Market" target="_blank" rel="nofollow"><i>Android</i> Market</a>.</p>
<p>Inainte de a incepe trebuie sa cunoasteti destul de bine limbajul de programare <strong>Java </strong>si conceptele <strong>Programarii Orientata Obiect</strong>; puteti sa aruncati o privire peste tutorialele noastre avansate: <a href="http://itassistant.org/programare/java-programare" title="Invata Java" target="_blank">Invata Java</a></p>
<h2> Android Intents </h2>
<p></p>
<p>Android este o platforma mobila bazate pe o arhitectura orientata pe servicii. Aplicatiile sunt compuse din componente independente care isi ofera servicii una alteia. Legatura dintre aceste componente se face prin Intent-uri. Acestea sunt de fapt obiecte ce sunt serializate si trimise catre sistem. Sistemul le analizeaza, hotareste care este cea mai buna componenta de destinatie, porneste componenta, si trimite Intent-ul mai departe acesteia.</p>
<h3> Propietatiile </h3>
<p></p>
<p>Fiecare <strong>Intent</strong> are urmatoarele propietati:</p>
<ul>
<li><strong>action:String</strong> &#8211; denumeste actiunea ce trebuie efectuata. Nu poate lipsi.</li>
<li><strong>data:Uri</strong> &#8211; datele asupra carora trebuie efectuata actiunea. Nu poate lipsi.</li>
<li><strong>category:String[]</strong> &#8211; o lista de informatii suplimentare ce definesc actiunea</li>
<li><strong>component:String/class</strong> &#8211; componenta care sa efectueze actiunea</li>
<li><strong>type:String</strong> &#8211; tipul datelor</li>
<li><strong>extra:Bundle</strong> &#8211; date suplimentare trimise componentei de destinatie</li>
</ul>
<h3> Action </h3>
<p></p>
<p>Acesta propietate defineste actiunea ce se doreste a fi indeplinita. Exemple de actiuni sunt:</p>
<ul>
<li><strong>ACTION_SEND</strong></li>
<li><strong>ACTION_CALL</strong></li>
<li><strong>ACTION_VIEW</strong></li>
<li><strong>ACTION_EDIT</strong></li>
<li><strong>ACTION_MAIN</strong></li>
</ul>
<p>Din punct de vedere al <strong>Java</strong>, actiunea este stocata sub forma unui <em>String</em>.</p>
<p>Acesta propietate nu poate lipsi.</p>
<p>Exemplu</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// crearea Intent-ului</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setarea unei actiuni predefinite in Android</span>
intent.<span style="color: #006633;">setAction</span> <span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">ACTION_EDIT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setarea unei actiuni definite de catre programator</span>
intent.<span style="color: #006633;">setAction</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;actiunea mea&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Data </h3>
<p></p>
<p>Acesta propietate reprezinta datele asupra carora sa se efectueze actiunea. Din punct de vedere Java, datele sunt stocate sub forma unui Uri. Exemple ar fi:</p>
<ul>
<li>tel:071334434</li>
<li>file:///sdcard/fisierul.txt</li>
<li>content://contacts/un_nume_de_contact</li>
</ul>
<p>Acesta propietate nu poate lipsi.</p>
<p>Se poate face urmatoarea analogie: daca intent-ul reprezinta o cerere <strong>HTTP</strong>, actiunea este metoda din <strong>HTTP</strong> iar datele sunt <em>URL-ul</em>. </p>
<p>Spre exemplu:</p>
<p><strong>HTTP</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">GET <span style="color: #339933;">/</span>index.<span style="color: #006633;">html</span> HTTP<span style="color: #339933;">/</span><span style="color: #cc66cc;">1.1</span>
Host<span style="color: #339933;">:</span> www.<span style="color: #006633;">android</span>.<span style="color: #006633;">com</span></pre></div></div>

<p><strong>Intent</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>action<span style="color: #339933;">=</span>android.<span style="color: #006633;">intent</span>.<span style="color: #006633;">action</span>.<span style="color: #006633;">VIEW</span><span style="color: #339933;">;</span> data<span style="color: #339933;">=</span>http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.android.com/index.html}</span></pre></div></div>

<p>Exemplu</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// crearea Intent-ului</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// setarea unei actiuni predefinite in Android</span>
intent.<span style="color: #006633;">setAction</span> <span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">ACTION_VIEW</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setarea datelor, in cazul de fata pagina www.android.com</span>
intent.<span style="color: #006633;">setData</span> <span style="color: #009900;">&#40;</span>Uri.<span style="color: #006633;">parse</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.android.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Category </h3>
<p></p>
<p><em>Categoriile</em> sunt memorate sub forma unui sir de String-uri. Acestea reprezinta informatii suplimentare despre actiunea ce trebui indeplinita. Cu ajutorul acestora, sistemul poate identifica mai bine cea mai buna componenta care sa efectueze actiunea. Exemple de categorii sunt:</p>
<ul>
<li><strong>CATEGORY_LAUNCHER</strong></li>
<li><strong>CATEGORY_HOME</strong></li>
<li><strong>CATEGORY_DEFAULT</strong></li>
</ul>
<p>Spre exemplu, componentele care pot efectua actiunea <strong>ACTION_MAIN</strong> sunt componentele de intrare intr-o aplicatie (in analogie cu programele standard, sunt clasele ce contin functia main). In functie de categorie, componentele sunt (lista este departe de a fi completa):</p>
<ul>
<li>plasate in meniul principal al telefonului (<strong>CATEGORY_LAUNCHER</strong>)</li>
<li>pornite cand se apasa butonul Home (<strong>CATEGORY_HOME</strong>)</li>
</ul>
<p>Exemplu</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// crearea Intent-ului</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setarea categoriilor carora le este destinate Intent-ul</span>
intent.<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>
intent.<span style="color: #006633;">addCategory</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;categorie nestandard&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Component </h3>
<p></p>
<p>Acesta propietate permite specificare exacta a componentei care trebuie sa efectueze actiunea. In general, componenta nu este speficicata ci este dedusa dupa analizarea celorlalte propietati. In cazul in care se specifica o componenta, sistemul o va porni direct, fara sa mai analizeze propietatiile celelalte.</p>
<p>Spre exemplu, daca dorim sa trimitem un email, vom specifica actiunea <strong>ACTION_SEND</strong>, adresa de destinatie si textul email-ului. Sistemul va determina automat care este programul de email predefinit si ne va deschide fereastra de editare a email-ului. In alanogie cu <strong>HTTP</strong>, avem acolo adresele <em>mailto:nume@adresa.de.email</em>.</p>
<p>In cazul in care dorim sa trimitem un email cu un anumit program, vom specifica actiunea <strong>ACTION_SEND</strong> si vom seta drept componenta de destinatie clasa din programul dorit.</p>
<p>Exemplu</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// crearea Intent-ului</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setarea componente, in cazul in care este in aceelasi pachet cu componenta ce va emite evenimentul</span>
<span style="color: #666666; font-style: italic;">// this reprezinta Contextul</span>
intent.<span style="color: #006633;">setClass</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, NumeClasa.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// daca componenta este in alta aplicatie (alt APK)</span>
intent.<span style="color: #006633;">setClassName</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;un.pachet&quot;</span>, <span style="color: #0000ff;">&quot;NumeClasa&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Type </h3>
<p></p>
<p>Acesta propietate este un String ce specifica tipul datelor din Intent. Daca nu este explicit specificat, tipul este dedus din Uri-ul datelor. Exemple</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">image<span style="color: #339933;">/</span>jpeg
audio<span style="color: #339933;">/</span>mp3
text<span style="color: #339933;">/</span>html<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Exemplu</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// crearea unui Intent</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setarea tipului</span>
intent.<span style="color: #006633;">setType</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;image/jpg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Extra </h3>
<p></p>
<p>Acesta este un parametru de tip <strong>Bundle</strong> cu ajutorul caruia putem atasa parametrii Intent-ului. Acest <strong>Bundle</strong> este trimis componentei de destinatie. Functiile puse la dispozitie sunt:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #003399;">String</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">double</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">long</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">boolean</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">byte</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span> putExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// etc.</span>
&nbsp;
<span style="color: #003399;">String</span> getStringExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> getStringArrayExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">double</span> getDoubleExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">double</span> defaultValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> getIntExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">int</span> defaultValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> getLongExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">long</span> defaultValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">boolean</span> getBooleanExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">boolean</span> defaultValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> getStringArrayListExtra <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// etc.</span></pre></div></div>

<p>Functiile <em>get&#8230;Extra(&#8230;)</em> intorc null in cazul in care parametru nu exista. Functiile care intorc tipuri primare (long, int, float, double, boolean, byte etc.) nu pot intoarce <strong>null</strong> (<strong>null</strong> este valid doar pentru obiecte), si astfel intoc valoarea lui <em>defaultValue</em> in cazul in care parametru nu exista.</p>
<h3> Exemple de utilizare </h3>
<p></p>
<p>In functie de tipul componentei de destinatie, pentru a emite un <strong>Intent</strong>, se folosesc una din functii:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// daca componenta este o activitate</span>
<span style="color: #000066; font-weight: bold;">void</span> startActivity <span style="color: #009900;">&#40;</span>Intent intent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// daca componenta este o activitate si acesta trebuie sa intoarce o valoare</span>
<span style="color: #000066; font-weight: bold;">void</span> startActivityForResult <span style="color: #009900;">&#40;</span>Intent intent, <span style="color: #000066; font-weight: bold;">int</span> requestCode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// daca componenta este un serviciu</span>
<span style="color: #000066; font-weight: bold;">void</span> startService <span style="color: #009900;">&#40;</span>Intent intent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Pornirea unei componente </h3>
<p></p>
<p>Unul din cele mai simple exemple de utilizare a unui Intent este pornirea unei alte componente din aceelasi pachet (program). Deoarece cunoastem exact ce componente dorim sa pornim, vom seta direct parametru <em>component</em>. Dearece componenta este o clasa, vom folosi functia <strong>setClass</strong> in loc de <strong>setComponent</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// construim un Intent</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setam componenta de destinatie (activitatea implmentata in clasa ActivitateDePornit)</span>
intent.<span style="color: #006633;">setClass</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, ActivitateDePornit.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// componenta de destinatie stim ca este o activitate, deci emitem Intent-ul cu startActivity</span>
<span style="color: #666666; font-style: italic;">// atentie, functia startActivity intoarce imediat, urmand ca sistemul sa porneasca la un moment dat fereastra</span>
startActivity <span style="color: #009900;">&#40;</span>intent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Pasarea de parametrii cartre alta componenta </h3>
<p></p>
<p>Din cauza modului de pornire a unei noi componente (o porneste sistemul, nu noi), ne este imposibil sa pasam direct parametrii. Nu avem nici o referinta (pointer) catre noua componenta. Astfel, pasarea parametrilor se face prin intermediul propietatii <strong>extre</strong> din intent-ul de pornire. Vom modifica in continuare exemplul de mai sus pentru a trimite un parametru ferestrei noi create:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// construim un Intent</span>
Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setam componenta de destinatie (activitatea implmentata in clasa ActivitateDePornit)</span>
intent.<span style="color: #006633;">setClass</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, ActivitateDePornit.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setam parametrul doi parametrii, un String cu numele &quot;nume&quot; si un numar cu numele &quot;numar&quot;</span>
intent.<span style="color: #006633;">putExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nume&quot;</span>, <span style="color: #0000ff;">&quot;un nume&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
intent.<span style="color: #006633;">putExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;numar&quot;</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// componenta de destinatie stim ca este o activitate, deci emitem Intent-ul cu startActivity</span>
<span style="color: #666666; font-style: italic;">// atentie, functia startActivity intoarce imediat, urmand ca sistemul sa porneasca la un moment dat fereastra</span>
startActivity <span style="color: #009900;">&#40;</span>intent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In activitatea pornita, preluam parametrii in felul urmator:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// preluam Intent-ul care ne-a pornit</span>
Intent intent <span style="color: #339933;">=</span> getIntent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// preluam parametrii</span>
<span style="color: #003399;">String</span> nume <span style="color: #339933;">=</span> intent.<span style="color: #006633;">getStringExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nume&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> numar <span style="color: #339933;">=</span> intent.<span style="color: #006633;">getIntExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;numar&quot;</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// afisam in log parametrii primiti</span>
Log.<span style="color: #006633;">d</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;intent&quot;</span>, <span style="color: #0000ff;">&quot;nume: &quot;</span><span style="color: #339933;">+</span>nume<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Log.<span style="color: #006633;">d</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;intent&quot;</span>, <span style="color: #0000ff;">&quot;nume: &quot;</span><span style="color: #339933;">+</span>numar<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3> Asteptarea unui raspuns </h3>
<p></p>
<p>De multe ori apar situatii in care o fereastra trebuie sa intoarca niste date ferestrei care a pornit-o. De exemplu, avem un program ce pastreaza o lista de filme. </p>
<p>Dorim sa adaugam un film nou, dar cum formularul de adaugare este mai mare, dorim sa cream o fereastra noua. Astfel, utilizatorul apasa pe butonul <em>Adaugare</em>, se deschide o fereatsra nou, utilizatorul completeaza datele noului film si apasa <em>Adauga</em>. Fereastra cu formularul se inchide si trimite datele inapoi fereastrei cu lista. Actiunea acestea se face in felul urmator:</p>
<p>Codul pentru butonul <strong>Adaugare</strong> din lista de filme:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Intent adauga <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// stim excat cine este componenta de destinatie</span>
adauga.<span style="color: #006633;">setClass</span> <span style="color: #009900;">&#40;</span>ListaFilme.<span style="color: #000000; font-weight: bold;">this</span>, FormularAdaugare.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// pronim activitatea si specificam ca dorim un raspuns</span>
<span style="color: #666666; font-style: italic;">// numarul 100 reprezinta un numar definit de noi</span>
startActivityForResult <span style="color: #009900;">&#40;</span>adauga, <span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Intoarcerea datelor se face prin intermediul unui obiect de tip <strong>Intent</strong>. Astfel, fereastra cu formularul va crea un nou Intent si il va trimit drept raspuns fereastrei cu lista.</p>
<p>Codul pentru butonul <em>Adauga</em> din formular este:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// cream obiectul de raspuns</span>
Intent raspuns <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setam parametrii</span>
raspuns.<span style="color: #006633;">putExtra</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nume&quot;</span>, nume.<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><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
raspuns.<span style="color: #006633;">putExtra</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;an&quot;</span>, <span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span> <span style="color: #009900;">&#40;</span>an.<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><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
raspuns.<span style="color: #006633;">putExtra</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;regizor&quot;</span>, regizor.<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><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// setam raspunsul, numarul 1 reprezinta un cod numeric al raspuinsului, definit de catre noi</span>
<span style="color: #666666; font-style: italic;">// in cazul nostru reprezinta butonul apasat </span>
<span style="color: #666666; font-style: italic;">// 1 - pentru Adauga</span>
<span style="color: #666666; font-style: italic;">// 0 - pentru renunte (vezi exemplul urmator)</span>
setResult <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, raspuns<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// inchidem formularul</span>
finish <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Vom presupune ca formularul nostru are si un buton de renunta. Codul pentru acest buton este:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// in cazul acesta nici nu mai trimitem un Intent, nu are rost </span>
<span style="color: #666666; font-style: italic;">// deoarece nu trimitem nici o informatie despre vreun film</span>
setResult <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// inchidem formularul</span>
finish <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In activitatea cu lista de filme, vom suprascrie functie <em>onActivityResult(&#8230;)</em>. Functia este apelata pentru orice activitate care intoarce un rezultat catre lista de filme (formular de adaugare, formular de modficare etc.), iar selectia se face dupa <strong>requestCode</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onActivityResult <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> requestCode, <span style="color: #000066; font-weight: bold;">int</span> responseCode, Intent data<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    	<span style="color: #666666; font-style: italic;">// raspunsul vine de la formularul de adaugare</span>
    	<span style="color: #666666; font-style: italic;">// acolo am cerut raspunsul cu nr 100</span>
    	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>requestCode <span style="color: #339933;">==</span> <span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span>
    	<span style="color: #009900;">&#123;</span>
    		<span style="color: #666666; font-style: italic;">// s-a apasat butonul Adauga</span>
    		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>responseCode<span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
    		<span style="color: #009900;">&#123;</span>
    			<span style="color: #003399;">String</span> nume <span style="color: #339933;">=</span> data.<span style="color: #006633;">getStringExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nume&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    			<span style="color: #000066; font-weight: bold;">int</span> an <span style="color: #339933;">=</span> data.<span style="color: #006633;">getIntExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;an&quot;</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    			<span style="color: #003399;">String</span> regizor <span style="color: #339933;">=</span> data.<span style="color: #006633;">getStringExtra</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;regizor&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    			<span style="color: #666666; font-style: italic;">// adaptor.adaugaFilm (nume, an, regizor);</span>
    		<span style="color: #009900;">&#125;</span>
    		<span style="color: #666666; font-style: italic;">// s-a apasat butonul Renunta</span>
    		<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>responseCode<span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
    		<span style="color: #009900;">&#123;</span>
    		<span style="color: #009900;">&#125;</span>
    	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<div style="text-align: center">
<a href="http://itassistant.org/pics/Android Intents.png" target="_blank"><img src="http://itassistant.org/pics/Android Intents.png" alt="Android Intents" title="Android Intents"/></a>
</div>
<p></p>
<h3> Android &#8211; Filtre de Intent-uri </h3>
<p></p>
<p>Fiecare componenta trebuie sa declare (in manifest) la ce Intent-uri raspunde, practic cu ce Intent-uri poate fi pornita. Astfel, fiecare componenta trebuie/poate declara:</p>
<ul>
<li><strong>actiunea</strong></li>
<li><strong>categorie</strong></li>
<li><strong>tipul</strong></li>
</ul>
<p>Exemplul urmator ilustreaza o activitate ce raspunde la actiunile <strong>EDIT</strong> si <strong>VIEW</strong> pentru tipul <em>image/jpeg</em> din categoria <em>DEFAULT</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.ImageActivity&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;Image Activity&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.action.EDIT&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.category.DEFAULT&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;data</span> <span style="color: #000066;">android:nameType</span>=<span style="color: #ff0000;">&quot;image/jpeg&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.action.VIEW&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.category.DEFAULT&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;data</span> <span style="color: #000066;">android:nameType</span>=<span style="color: #ff0000;">&quot;image/jpeg&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-7.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defragmentarea HDD-ul cu Auslogics Disk Defrag</title>
		<link>http://itassistant.org/os-usage/os-tweaks/windows-os-tweaks/defragmentarea-hdd-ul-cu-auslogics-disk-defrag.html</link>
		<comments>http://itassistant.org/os-usage/os-tweaks/windows-os-tweaks/defragmentarea-hdd-ul-cu-auslogics-disk-defrag.html#comments</comments>
		<pubDate>Sat, 21 Jan 2012 12:09:42 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Auslogics Disk Defrag]]></category>
		<category><![CDATA[defragmentare]]></category>
		<category><![CDATA[hdd]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4839</guid>
		<description><![CDATA[Tutorial ce prezinta modul in care puteti defragmenta hard-disk-ul cu ajutorul programului Auslogics Disk Defrag.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4839.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salut! Bine ati venit pe ITassistant.org! Eu sunt Vlad si o sa va prezint in acest tutorial cum se defragmenteaza HDD-ul (hard disk drive-ul) cu ajutorul programului <strong>Auslogics Disk Defrag</strong>.</p>
<p>Pe <em>Itassistant.org</em> mai este un tutorial pe aceasta tema: <a href="http://itassistant.org/os-usage/os-tweaks/windows-os-tweaks/cum-si-de-ce-sa-ti-defragmentezi-hard-disk-ul.html" title="Defragmentare HDD" target="_blank">http://itassistant.org/os-usage/os-tweaks/windows-os-tweaks/cum-si-de-ce-sa-ti-defragmentezi-hard-disk-ul.html</a></p>
<p>Pentru a downloada <strong>Auslogiucs Disk Defrag </strong>accesati linkul urmator si dati clik pe download : <a target="_blank" href="http://www.auslogics.com/en/software/disk-defrag/" title="Defragmentare HDD" target="_blank" rel="nofollow">http://www.auslogics.com/en/software/disk-defrag/</a></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 1.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 1.jpg" alt="Program defragmentare - Auslogics Disk Defrag" title="Program defragmentare - Auslogics Disk Defrag"/></a>
</div>
<p></p>
<h3> Instalare program defragmentare &#8211; Auslogics Disk Defrag </h3>
<p></p>
<p>Dupa ce ati downloadat executabilul il rulati prin dublu-clik. In fereastra care a aparut in dreapta jos se afla butonul NEXT pe care o sa dam clik.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 2.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 2.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>Acceptam termenii contractuali bifand optiunea &#8220;<em>I accept the agreement</em>&#8221; si dand clik pe next.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 3.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 3.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>La acest pas setup-ul ne va intreba unde sa se instaleze programul de <b>defragmentare</b> <strong>Auslogics Disk Defrag</strong>. Pentru a schimba locatia dam clik pe <em>Browse… </em>. Pentru a continua clik pe next. </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 4.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 4.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>Acum vom fi intrebati in ce folder sa se instaleze programul. (eu va recomand sa nu il schimbati) Dam clik pe <em>next</em>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 5.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 5.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>Daca vrem sa ne faca o iconita pe desktop cu o scurtatura catre program lasam bifata casuta &#8220;<em>Create desktop icon</em>&#8221; iar daca nu vrem debifam casuta. Clik pe <em>next</em>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 6.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 6.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>O sa inceapa setup-ul. Instalarea nu o sa dureze foarte mult.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 7.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 7.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>La ultimul pas o sa ne intrebe daca vrem sa lanseze automat programul. Daca nu vrem debifam casuta &#8220;<em>Launch Auslogics Disk Defram</em>&#8221; si dam clik pe <em>finish</em>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 8.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 8.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>Asa arata programul la prima lansare:</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 9.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 9.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>In partea de sus sunt afisate partitiile. Selectam partitia care vrem sa o defragmentam apoi dam clik dreapta pe ea si selectam optiunea pe care o vrem sa o executam.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 10.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 10.jpg" alt="Auslogics Disk Defrag" title="Auslogics Disk Defrag"/></a>
</div>
<p></p>
<h2> Optiuni defragmentare &#8211; Auslogics Disk Defrag </h2>
<p></p>
<ul>
<li><strong>analize</strong> &#8211; pentru a analiza partitia</li>
<li><strong>defrag</strong> &#8211; pentru a defragmenta partitia</li>
<li><strong>defrag &#038; optimize</strong> &#8211; pentru <i>defragmentare</i> si optimizare</li>
<li><strong>quick defrag</strong> &#8211; pentru defragmentare repida</li>
<li><strong>check for errors</strong> –cautare erori</li>
<li><strong>properties</strong> – pentru proprietati</li>
<li><strong>check all</strong> – pentru verificarea tuturor partitiilor</li>
<li><strong>uncheck</strong> – pentru debifare</li>
<li><strong>invert checkboxes</strong> &#8211; pentru a inversa casutele</li>
<li><strong>check local disk drive</strong> &#8211; pentru a verifica unitatea de disk locala</li>
</ul>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Auslogics Disk 11.jpg" target="_blank"><img src="http://itassistant.org/pics/Auslogics Disk 11.jpg" alt="Program defragmentare - Auslogics Disk Defrag" title="Program defragmentare - Auslogics Disk Defrag"/></a>
</div>
<p></p>
<p>Sper ca va placut acest tutorial! Eu am fost Vlad iar voi ati fost pe Itassistant.org. Pentru mai multe tutoriale vizitati Itassistant.org. La revedere!</p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/os-usage/os-tweaks/windows-os-tweaks/defragmentarea-hdd-ul-cu-auslogics-disk-defrag.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpBB &#8211; Cum creezi un grup de utilizatori noi</title>
		<link>http://itassistant.org/internet/phpbb-internet/tutorial-phpbb-cum-creezi-un-grup-de-utilizatori-noi.html</link>
		<comments>http://itassistant.org/internet/phpbb-internet/tutorial-phpbb-cum-creezi-un-grup-de-utilizatori-noi.html#comments</comments>
		<pubDate>Thu, 19 Jan 2012 15:07:34 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[PHPBB]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[utilizatori]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4834</guid>
		<description><![CDATA[Tutorial ce prezinta modul in care puteti sa creati un nou grup de utilizatori pentru forumul vostru phpBB]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4834.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salut numele meu este Paul, sunt aici din partea ITAssistang.org, si in acest tutorial va voi arata cum sa creati un nou grup pe forumul vostru <b>phpBB</b> (<i>phpBB</i> inseamna <strong>php bulletin board </strong>si este unul dintre cele mai folosite script-uri de forum din lume. Asta datorita faptului ca este gratis, usor de instalat si de modificat).</p>
<h2> Pasii pentru crearea unui grup pt forumul phpBB sunt: </h2>
<p></p>
<p>Pentru inceput ne logam pe contul de <em>adminstrator</em> si intram in<em> Utilizatori si grupuri -> Administrare grupuri</em></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/phpBB utilizatori 1.png" target="_blank"><img src="http://itassistant.org/pics/phpBB utilizatori 1.png" alt="Tutorial phpBB" title="Tutorial phpBB"/></a>
</div>
<p></p>
<p>Aici vom scrie in casuta aceea numele noului grup dupa care dati <strong>TRIMITE</strong>!</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/phpBB utilizatori 2.png" target="_blank"><img src="http://itassistant.org/pics/phpBB utilizatori 2.png" alt="Tutorial phpBB" title="Tutorial phpBB"/></a>
</div>
<p></p>
<p>Daca vrem ca grupul sa apara in legenda bifam &#8220;<em>Arata grupul in legenda</em>&#8220;</p>
<p>Daca vrem ca grupul sa primeasca mesaje private bifam &#8220;<em>Grupul poate sa primeasca mesaje private</em>&#8220;</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/phpBB utilizatori 3.png" target="_blank"><img src="http://itassistant.org/pics/phpBB utilizatori 3.png" alt="Tutorial phpBB" title="Tutorial phpBB"/></a>
</div>
<p></p>
<p>Pentru a seta grupului culoarea cautam in &#8220;<em>Culoarea Grupului</em>&#8220;</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/phpBB utilizatori 4.png" target="_blank"><img src="http://itassistant.org/pics/phpBB utilizatori 4.png" alt="Tutorial phpBB" title="Tutorial phpBB"/></a>
</div>
<p></p>
<p>Dam click pe &#8220;M<em>onstra culoare web-safe</em>&#8221; si alegem culoarea</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/phpBB utilizatori 5.png" target="_blank"><img src="http://itassistant.org/pics/phpBB utilizatori 5.png" alt="Tutorial phpBB" title="Tutorial phpBB"/></a>
</div>
<p></p>
<p>Dupa ce am facut urmarit toti acesti pasi apasam pe butonul <em>Trimite</em></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/phpBB utilizatori 6.png" target="_blank"><img src="http://itassistant.org/pics/phpBB utilizatori 6.png" alt="Tutorial phpBB" title="Tutorial phpBB"/></a>
</div>
<p></p>
<p>Acum grupul este creat, mai trebuie doar sa facem permisiunile la el, dar acest lucru va fi prezentat in alt tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/internet/phpbb-internet/tutorial-phpbb-cum-creezi-un-grup-de-utilizatori-noi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cinema 4d download si instalare &#8211; Partea 1</title>
		<link>http://itassistant.org/grafica/cinema-4d-download-si-instalare-partea-1.html</link>
		<comments>http://itassistant.org/grafica/cinema-4d-download-si-instalare-partea-1.html#comments</comments>
		<pubDate>Thu, 19 Jan 2012 14:46:46 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Grafica]]></category>
		<category><![CDATA[4d]]></category>
		<category><![CDATA[animatie tridimensionala]]></category>
		<category><![CDATA[cinema]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[grafica]]></category>
		<category><![CDATA[instalare]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4831</guid>
		<description><![CDATA[Tutorial video ce prezinta un soft de grafica si animatie tridimensionala - Cinema 4d - Partea 1]]></description>
			<content:encoded><![CDATA[<object width="540" height="360"><param name="movie" value="http://www.youtube.com/v/0V3MvexVN0s?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0V3MvexVN0s?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="540" height="360" allowscriptaccess="always" allowfullscreen="true"></embed></object><p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4831.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe itassistant.org, eu sunt Mihai Robert Craciun, iar voi sunteti la primul tutorial de <strong>grafica si animatie tridimensionala aici pe site</strong>. Pentru aceasta am ales un pachet de 3d destul de cunosut, el se numeste <b>cinema</b> <strong>4d Studio</strong>  (momentan versiunea R12). </p>
<p>Stiu ca nu este un tutorial relativ nou pentru multi dintre dumneavoastra acest soft a mai fost prezentat si in trecut in romania de alte persoane dar cum nu i sa acordat o importanta prea mare ne-am gandit ca sa deschidem aceasta serie de tutoriale in care vom valorifica la maxim acest program. </p>
<h2> De ce am ales Cinema 4d? </h2>
<p></p>
<p>Raspunsul este foarte simplu: Pentru usurinta in folosire a acestuia. Sa nu intelegeti din asta ca nu este un program profesional, din contra este un program profesional dar care vine cu o interfata aerisiat, bine structurata in care, pentru a o utiliza talentul nu este necesar dar este binevenit. </p>
<p>Pe langa multele atuuri ale acestui program el poate comunica foarte usor cu alte programe, de exemplu poate importa si exporta fisiere de <em>photoshop, illustrator, chiar si 3ds max</em>.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Cinema4D.gif" target="_blank"><img src="http://itassistant.org/pics/Cinema4D.gif" alt="Cinema 4d" title="Cinema 4d"/></a>
</div>
<p></p>
<p>Mai vreau sa adaug ca folosesc aproximativ de 2 ani acest program si sunt foarte multumit de el, asta este si unul dintre motivele pentru care incep aceasta serie de tutoriale. Cu toate ca este un program comercial mi se pare relativ ieftin in comparatie cu cea ce face si daca stam sa ne gandim un program cum ar fi <strong>Maya 3d</strong> costa o avere plus cartile sau cursurile pe care la un moment dat ar trebui sa le platiti ar lasa un gol destul de adanc in buzunarele dumnevoastra.  </p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/grafica/cinema-4d-download-si-instalare-partea-1.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Configurare sistem de streaming video</title>
		<link>http://itassistant.org/securitate/configurare-sistem-de-streaming-video-pentru-supraveghere.html</link>
		<comments>http://itassistant.org/securitate/configurare-sistem-de-streaming-video-pentru-supraveghere.html#comments</comments>
		<pubDate>Mon, 16 Jan 2012 07:51:22 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Securitate]]></category>
		<category><![CDATA[configurare]]></category>
		<category><![CDATA[sistem]]></category>
		<category><![CDATA[streaming]]></category>
		<category><![CDATA[supraveghere]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4967</guid>
		<description><![CDATA[Tutorial video ce prezinta o configurare de sistem de streaming video pentru supraveghere.]]></description>
			<content:encoded><![CDATA[<object width="540" height="360"><param name="movie" value="http://www.youtube.com/v/AX8HR1AV_CQ?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/AX8HR1AV_CQ?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="540" height="360" allowscriptaccess="always" allowfullscreen="true"></embed></object><p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4967.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salut, bine ati venit pe ITassistant.org, in tutorialul de mai jos, va prezint un <b>sistem</b> PC, pe care o sa il folosim la un <i>sistem</i> de supraveghere de 4 sau 32 de camera, sau video din alte surse. </p>
<p>Avem nevoie de un sistem <em>low power</em>, care nu consuma multe resurse. Am ales o placa de la Intel, si un processor tot de la Intel, ca sa nu existe incompatibilitati de sistem. Dupa cum stiti placa Intel de baza, are o mica chestie, care alte placi nu o au, booteaza foarte repede in comparative cu alte placi. </p>
<p>Memoria RAM 4GB este de ajuns in modul Dual Channel. </p>
<p>La partea de HDD este optional, pentru ca stiti ca in perioada aceasta HDD-urile sunt foarte scumpe, din cauza inundatilor din Thailanda. Si am pus o carcasa Mini-ITX care nu ocupa spatiu, care are o sursa Chieftec de 200W reali. </p>
<p>Si pentru economisirea cablurilor de retea, am pus si un modul Wireless care va ajuta sa numai folositi cablurile RJ-45, asta bineinteles daca aveti router wireless. Si in caz ca si pachetul de camera al vostru contine si iesire pe Wireless, economisiti si mai multe fire, o idee buna zic eu.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/sistem de streaming video.jpg" target="_blank"><img src="http://itassistant.org/pics/sistem de streaming video.jpg" alt="Configurare sistem de streaming video pentru supraveghere" title="Configurare sistem de streaming video pentru supraveghere"/></a>
</div>
<p></p>
<h2> Link-uri produse &#8211; sistem de streaming video </h2>
<p></p>
<ul>
<li><a target="_blank" href="http://profitshare.emag.ro/click.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331&#038;redirect=placi_baza/placa-de-baza-intel-dh61dlb3-socket-1155-bulk--pINBLKDH61DLB3" rel="nofollow">Placa de Baza</a><img src="http://profitshare.emag.ro/link_track.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331" alt="sistem"border="0" width="1" height="1" style="border:none !important; margin:0px !important;" /></li>
<li><a target="_blank" href="http://profitshare.emag.ro/click.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331&#038;redirect=procesoare/procesor-intel-174-celeron-174-g530-2400mhz-2mb-socket-1155-box--pBX80623G530" rel="nofollow">Procesor</a><img src="http://profitshare.emag.ro/link_track.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331" alt="sistem"border="0" width="1" height="1" style="border:none !important; margin:0px !important;" /></li>
<li><a target="_blank" href="http://profitshare.emag.ro/click.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331&#038;redirect=memorii/memorie-kingmax-ddr-iii-2gb-1333mhz--pFLFE8-DDR3-2G1333" rel="nofollow">Memorie</a><img src="http://profitshare.emag.ro/link_track.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331" alt="sistem"border="0" width="1" height="1" style="border:none !important; margin:0px !important;" /></li>
<li><a target="_blank" href="http://profitshare.emag.ro/click.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331&#038;redirect=carcase/carcasa-chieftec-fi-02bc-mini-itx-200w-neagra--pFI-02BC" rel="nofollow">Carcasa</a><img src="http://profitshare.emag.ro/link_track.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331" alt="sistem"border="0" width="1" height="1" style="border:none !important; margin:0px !important;" /></li>
<li><a target="_blank" href="http://profitshare.emag.ro/click.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331&#038;redirect=hard_disk-uri/hdd-western-digital-caviar-blue-kx-500gb-16mb-7200rpm-sata-3--pWD5000AAKX" rel="nofollow">HDD</a><img src="http://profitshare.emag.ro/link_track.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331" alt="sistem"border="0" width="1" height="1" style="border:none !important; margin:0px !important;" /></li>
<li><a target="_blank" href="http://profitshare.emag.ro/click.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331&#038;redirect=adaptoare_ethernet/placa-de-retea-wireless-tp-link-tl-wn781nd-pci--pTL-WN781ND" rel="nofollow">Modul Wireless</a><img src="http://profitshare.emag.ro/link_track.php?ad_client=18d0c6f2d4c5e71ef6ede21f6907ab6f&#038;add_id=147331" alt="sistem"border="0" width="1" height="1" style="border:none !important; margin:0px !important;" /></li>
</ul>
<p>Daca intampinati ceva probleme, lasati-ne <em>feedback</em>!</p>
<p><strong>Atentie!</strong> Pe acest sistem, bagati doar softurile necesare pentru video, si folositi <em>Windows 7 Home Premium</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/securitate/configurare-sistem-de-streaming-video-pentru-supraveghere.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ghid despre realizarea unui tutorial video de calitate</title>
		<link>http://itassistant.org/os-usage/os-tweaks/ghid-despre-realizarea-unui-tutorial-video-de-calitate.html</link>
		<comments>http://itassistant.org/os-usage/os-tweaks/ghid-despre-realizarea-unui-tutorial-video-de-calitate.html#comments</comments>
		<pubDate>Wed, 28 Dec 2011 09:37:05 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[OS Tweaks]]></category>
		<category><![CDATA[calitate]]></category>
		<category><![CDATA[documentare]]></category>
		<category><![CDATA[inregistrare]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4780</guid>
		<description><![CDATA[Articol ce prezinta pasii importanti pentru a crea un tutorial video de calitate.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4780.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salut, numele meu este Mihai si inainte de a ataca subiectul de astazi tin sa va urez &#8220;<strong>Sarbatori Fericite!</strong>&#8221; si &#8220;<strong>La Multi Ani!</strong>&#8220;. Sa ne vedem cu bine si in anul 2012! <img src='http://itassistant.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Foarte multi dintre voi va uitati la tutoriale video pe Internet. Unii dintre cei care o faceti doriti si voi sa faceti tutoriale video, chiar pe ITAssistant.org. Asa ca m-am gandit sa postez un mic ghid despre cum se face un <b>tutorial</b> video bun si de calitate.</p>
<h2> Pasul I: Alegerea subiectului </h2>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 4.jpg" target="_blank"><img src="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 4.jpg" alt="Ghid despre realizarea unui tutorial video de calitate" title="Ghid despre realizarea unui tutorial video de calitate"/></a>
</div>
<p></p>
<p>Nu putem vorbi despre orice. Subiectul trebuie ales cu grija. Ne uitam si noi daca nu s-a mai facut un tutorial asemenator, sau daca subiectul nu este prea comun, adica un tutorial despre cum se da Copy-Paste. Exista sanse mari sa primiti multe comentarii si voturi negative, din cauza ca ei care se uita la tutorial il considera &#8220;prea usor&#8221;.</p>
<p>Subiectul in general trebuie sa fie unul original. Originalitatea este una din conditiile succesului unui tutorial video, mai ales daca acesta este postat pe <a target="_blank" href="http://www.youtube.com/user/TheItAssistant" title="YouTube - ItAssistant" target="_blank" rel="nofollow">YouTube</a>.</p>
<h2>Pasul II: Documendarea si organizarea prezentarii </h2>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 5.jpg" target="_blank"><img src="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 5.jpg" alt="Ghid despre realizarea unui tutorial video de calitate" title="Ghid despre realizarea unui tutorial video de calitate"/></a>
</div>
<p></p>
<p>Avem subiectul, dar cum il abordam? Nu putem doar sa vorbim despre el din ce stim noi, sau ce am auzit de la prieteni. Acest gen de tutorial intra la &#8220;Asa NU&#8221;.</p>
<p>Fara o documentare solida, nu putem sa ne prezentam in fata privitorilor nostri. Daca printre ei se nimereste un &#8220;expert&#8221;, care stie foarte multe despre acel subiect?</p>
<p>Asa ca ne punem pe citit. Sa zicem ca vrem sa facem un tutorial despre un soft. In primul rand descarcam soft-ul si ne uitam atent la el si toate optiunile sale. </p>
<p>Daca exista un lucru pe care nu stim cum sa il abordam, sau care nu stim cum se face (de exemplu o functie), folosim un motor de cautare si mai mult ca sigur ca vom afla.</p>
<p>Dupa ce cunoastem bine program-ul, este bine (macar la primele doua-trei tutoriale video) sa ne facem un plan de prezentare, adica sa ne organizam pe o foaie  modul de a prezenta acel soft. Nu putem sa incepem de oriunde, trebuie sa avem un fir logic pentru a putea fi urmariti mai usor.</p>
<p><strong>ATENTIE!</strong> Nu folositi cuvinte si/sau expresii pe care nu le stapaniti bine, doar ca sa dati impresia ca sunteti superiori. Se trezeste vreun vizitator sa va intrebe ce inseamna acel cuvant/expresie si voi sa nu stiti. Nu e sinonim cu &#8220;m-am facut de ras&#8221;?</p>
<p>Incercati sa folositi un limbaj cat mai explicit. Daca introduceti o notiune noua, incercati sa o explicati cat mai bine.</p>
<p>Sa nu va fie frica sa faceti analogii cu viata reala. Dand exemple din viata reala (desi pare o tammpenie), utilizatorii neinitiati vor intelege mult mai bine, facand conexiuni.</p>
<h2>Pasul III: Inregistrarea tutorialului </h2>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 1.jpg" target="_blank"><img src="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 1.jpg" alt="Ghid despre realizarea unui tutorial video de calitate" title="Ghid despre realizarea unui tutorial video de calitate"/></a>
</div>
<p></p>
<p>Aici vine partea cea mai grea. Tin minte ca la primul meu tutorial de baiat mare, am avut emotii mari cat casa, a trebuit sa il inregistrez de zeci de ori, pana sa iasa bine. Ideea era ca trebuia sa fie perfect, asa cerea &#8220;seful&#8221; meu de atunci si avea motive sa o faca. </p>
<p>Chiar si astazi sunt foarte dur cu mine si la orice greseala intrerupt captura si o reiau de la capat.</p>
<p>Trebuie sa avem grija si la modul in care vorbim. Nu incepem sa vorbim repede si apoi incet, ca ne-am plictisit, trebuie sa continuam in aceiasi nota. Iarasi foarte important, aici nu se aplica regula &#8220;Pauzele lungi si dese, cheia marilor succese!&#8221;. Facand pauze, dam dovada de nesiguranta si pe deasupra, cel care ne vede se poate plictisi, oprind vizionarea tutorialului.</p>
<p>Din punct de vedere tehnic, realizati captura la o rezolutie decenta (recomandat 1280*720). Nu vorbiti departe de microfon si nu tipati, oricat de bucurosi sunteti ca veti aparea pe Internet.</p>
<h2>Pasul IV: Codarea si postarea tutorialului </h2>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 2.jpg" target="_blank"><img src="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 2.jpg" alt="Ghid despre realizarea unui tutorial video de calitate" title="Ghid despre realizarea unui tutorial video de calitate"/></a>
</div>
<p></p>
<p>Codarea este bine sa se faca in format <strong>MP4</strong> (calitate 50% e suficient). E bine sa puneti un <em>watermark</em> (logo, imagine) pe tutorialele voastre, pentru a nu fi copiate si puse pe alte canale de <strong>YouTube</strong>, sau pe alte site-uri.</p>
<p>Titlul tutorialui trebuie sa fie atragator. De exemplu daca facem un tutorial despre cum se instaleaza Windows XP, nu il numim &#8220;Movie_1.mp4&#8243;, ci putem sa ii spunem &#8220;<em>Tutorial video instalare Windows XP [HD]</em>&#8220;. Astazi se pune accent  foarte mult pe continutul HD.</p>
<h2>Pasul V: Discutia cu utilizatorii </h2>
<p></p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 3.jpg" target="_blank"><img src="http://itassistant.org/pics/Ghid despre realizarea unui tutorial video de calitate 3.jpg" alt="Ghid despre realizarea unui tutorial video de calitate" title="Ghid despre realizarea unui tutorial video de calitate"/></a>
</div>
<p></p>
<p>Este foarte importanta comunicarea cu utilizatorii. De aceea spuneam mai sus ca este foarte important modul in care ne documentam. Trebuie sa stim bine despre ceea ce vorbim si poate un pic mai mult. Sunt foarte multi useri care au nelamuriri si noi suntem oarecum obligati sa le clarificam. Daca ei simt ca noi nu suntem stapani pe subiect, ne vor privi tutorialele cu scepticism.</p>
<p>Sper ca acest articol sa va fie util. In cazul in care vreti sa postati tutoriiale la noi pe site, nu ezitati sa ne contactati. Mai multe detalii gasiti in drepta site-ului. O zi buna in continuare!</p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/os-usage/os-tweaks/ghid-despre-realizarea-unui-tutorial-video-de-calitate.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Instalare Microsoft Windows 8 Developer Preview</title>
		<link>http://itassistant.org/os-usage/windows-os-usage/instalare-microsoft-windows-8-developer-preview.html</link>
		<comments>http://itassistant.org/os-usage/windows-os-usage/instalare-microsoft-windows-8-developer-preview.html#comments</comments>
		<pubDate>Sun, 25 Dec 2011 22:55:44 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[instalare]]></category>
		<category><![CDATA[masina virtuala]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[virtual box]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4771</guid>
		<description><![CDATA[Tutorial ce prezinta modul in care puteti sa instalati Windows 8 - noul sistem de operare de la Microsoft (pe propriul PC sau in masina virtuala).]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4771.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Salut prieteni! Bine ati venit pe Itassistant.org astazi o sa va arat cum se intsaleaza <strong>Microsoft Windows 8 Developer Preview</strong>.</p>
<p>Acest sistem  se poate instala pe masina virtuala (ex: <strong>Virtual Box</strong> sau <strong>VMware</strong>) doar daca procesorul vostru suporta virtualizare.</p>
<p>Fiecare stie ce procesor are si daca acesta suporta virtualizare <img src='http://itassistant.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3> Cerintele de sistem pentru acest nou Windows sunt urmatoarele: </h3>
<p></p>
<ul>
<li>	Procesor 1 GHz sau mai bun</li>
<li>	1 GB RAM ( 2GB pentru versiunea pe 64bit)</li>
<li>	16 GB liberi pe HDD (20 GB pentru versiunea pe 64bit)</li>
<li>	driver grafic DirectX 9 cu WDDM 1.0 sau mai bun</li>
</ul>
<p>Dupa cum ati putut vedea cerintelea cestui <i>Windows</i> nu sunt exagerate. (asemanatoare cu cele pt Windows 7).</p>
<p>Dupa ce ati downloadat imaginea ISO cu Windows 8 o <em>ardeti</em> pe un DVD sau o puneti pe un stik USB (merge doar cu soft-ul de la <strong>Microsoft</strong>) intrati in BIOS setati ca sa booteze de pe Dvd sau stikul USB.</p>
<p>1. Introduceti Dvd cu Windows 8 in unitatea optica si dati restart la PC.<br />
2. Cand apare mesajul &#8220;<em>Press any key to boot from CD or DVD</em>&#8221; ca saintre in Setup apasati orice tasta.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (1).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (1).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>3. Selectati limba (recomand sa lasati English) </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (2).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (2).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>4. Aceptati termenii contractuali</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (3).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (3).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>5. Acum am ajuns la pasul in la care trebuie sa creem partitiile. (In cazul in care avetiun HDD mai mic sau egal de 30 GB eu recomand sa lasati doar o partitie)</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (4).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (4).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>6. Acum asteptati sa copieze fisierele de pe DVD/stik USB in HDD. Eventual PC-ul se va restarta de cateva ori. </p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (5).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (5).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>7. Acceptam iar termenii si conditiile</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (6).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (6).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>8. Dam numele Pc-ului, apoi dam clik pe butonul NEXT.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (7).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (7).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>9. Datorita faptului ca Windows 8 este un sistem de operare dual el vine si cu un dublu mod de autentificare si anume:<br />
•	<strong>mod local</strong> – prin care se creaza un nume de utilizator<br />
•	<strong>mod web </strong>– prin care se poatefolosii un cont de windows live</p>
<p>Deoarece in momentul crearii contului de autentificare nu avem si posibilitatea crearii unei conexiuni de tip PPPOE cei care folosesc acest mod vor trebui sa foloseasca modul de autentificare local.</p>
<p>Pentru cei care nu stiu la ce m-am referit aici este vorba de iconita aceea de la RDS sau Romtelecom in care trebuie sa aveti introdus un user si o parola ca sa va mearga Internetul.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (8).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (8).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>10. Creati userul si daca doriti puteti sa puneti si o parola.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (9).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (9).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>11. Daca ati urmat pasi de mai sus corect acum ar trebui ca Windows 8 sa fie gata de utilizare.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/Instalare Windows 8 (10).jpg" target="_blank"><img src="http://itassistant.org/pics/Instalare Windows 8 (10).jpg" alt="Instalare Microsoft Windows 8" title="Instalare Microsoft Windows 8"/></a>
</div>
<p></p>
<p>Pentru cei care nu stiu puteti downloada Windows 8 de aici: <a target="_blank" href="http://msdn.microsoft.com/en-us/windows/apps/br229516" title="Windows 8" target="_blank" rel="nofollow">http://msdn.microsoft.com/en-us/windows/apps/br229516</a> ; tot aici gasiti si alte detalii despre Windows 8.</p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/os-usage/windows-os-usage/instalare-microsoft-windows-8-developer-preview.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Invata Sistemul de Operare Android &#8211; Partea 6</title>
		<link>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-6.html</link>
		<comments>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-6.html#comments</comments>
		<pubDate>Sat, 17 Dec 2011 11:29:51 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Activity]]></category>
		<category><![CDATA[ArrayAdapter]]></category>
		<category><![CDATA[BaseAdapter]]></category>
		<category><![CDATA[Gallery]]></category>
		<category><![CDATA[GridView]]></category>
		<category><![CDATA[ListActivity]]></category>
		<category><![CDATA[liste]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4564</guid>
		<description><![CDATA[Invata Sistemul de Operare Android - Partea 6 - serie de tutoriale isi propune sa va familiarizeze cu Sistemul de Operare Android astfel incat sa puteti sa scrieti singuri aplicatii pentru propriul SmartPhone.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4564.jpg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe ItAssistant. Aceasta noua serie de tutoriale isi propune sa va familiarizeze cu <strong>Sistemul de Operare Android </strong>astfel incat sa puteti sa scrieti singuri <em>aplicatii </em>pentru propriul <strong>SmartPhone</strong>, si de ce nu, aplicatia sa ajunga in top pe <a target="_blank" href="https://market.android.com/" title="Android Market" target="_blank" rel="nofollow"><i>Android</i> Market</a>.</p>
<p>Inainte de a incepe trebuie sa cunoasteti destul de bine limbajul de programare <strong>Java </strong>si conceptele <strong>Programarii Orientata Obiect</strong>; puteti sa aruncati o privire peste tutorialele noastre avansate: <a href="http://itassistant.org/programare/java-programare" title="Invata Java" target="_blank">Invata Java</a></p>
<h2> Android &#8211; Liste &#8211; BaseAdapter </h2>
<p></p>
<p>Pentru lista ce trebuie sa afiseze informatii mai complexe decat un rand de text, trebuie sa scriem un <strong>adaptor </strong>(o clasa ce implmenteaza interfata <em>ListAdapter</em>). Pentru ca interfata <em>ListAdapter </em>are foarte multe metode, un mod mai simplu este sa extindem clasa <strong>BaseAdapater</strong>. De fapt trebuie sa implementam urmatoarele patru functii:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MyAdapter <span style="color: #000000; font-weight: bold;">extends</span> BaseAdapter
<span style="color: #009900;">&#123;</span>
	@Override
	<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 list<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// functia trebuie sa intoarca view-ul de pe pozitia position din lista</span>
		<span style="color: #666666; font-style: italic;">// convertView este un element din lista ce nu mai este vizibil si poate fi convertit</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;">int</span> getCount <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;">// intaorce nr de elemente din lista</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Object</span> getItem<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// intoarce elementul de pe pozitia position din model</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;">long</span> getItemId<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// fiecare element din lista poate avea un id, nu este insa obligatoriu</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pentru a exemplifica mai bine, vom modifica exemplul de mai sus, astfel incat sa afisam doua linii de text. Clasa <em>Personaj </em>ramane aceeasi ca in exemplul: <a href="http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-5.html" title="Invata Sistemul de Operare Android" target="_blank">Invata Sistemul de Operare Android – Partea 5</a>.</p>
<p>Primul pas este sa realizam un nou fisier<strong> XML</strong> (separat) ce va descrie cum arata fiecare element grafic (<em>View</em>) din lista. Il vom plasa in</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">res<span style="color: #000000; font-weight: bold;">/</span>layout<span style="color: #000000; font-weight: bold;">/</span>personaj.xml</pre></div></div>

<p><em>personaj.xml</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">  <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>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/personaj_nume&quot;</span></span>
<span style="color: #009900;">  	     <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">  	     <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">  	     <span style="color: #000066;">android:textStyle</span>=<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/personaj_desen&quot;</span></span>
<span style="color: #009900;">  	     <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">  	     <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Urmeaza sa realizam fisierul cu codul sursa. Acesta va contine o clasa ce extinde BaseAdapter si clasa activitatii (<strong>ListActivity</strong>).</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Personaj
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> nume<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> desen<span style="color: #339933;">;</span>
&nbsp;
    @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: #666666; font-style: italic;">// acesta functie este apelata de catre ArrayAdapter pentru a transforma obiectul intr-un String ce</span>
        <span style="color: #666666; font-style: italic;">// sa fie afisat in lista</span>
        <span style="color: #000000; font-weight: bold;">return</span> nume<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; din desenul animat &quot;</span><span style="color: #339933;">+</span>desen<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> PersonajeAdapter <span style="color: #000000; font-weight: bold;">extends</span> BaseAdapter
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> Activity context<span style="color: #339933;">;</span>
	ArrayList<span style="color: #339933;">&lt;</span>Personaj<span style="color: #339933;">&gt;</span> personaje<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> PersonajeAdapter <span style="color: #009900;">&#40;</span>Activity _context<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">context</span> <span style="color: #339933;">=</span> _context<span style="color: #339933;">;</span>
		personaje <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Personaj<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<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 list<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// functia trebuie sa intoarca view-ul de pe pozitia position din lista</span>
		<span style="color: #666666; font-style: italic;">// convertView este un element din lista ce nu mai este vizibil si poate fi convertit</span>
		<span style="color: #003399;">View</span> element<span style="color: #339933;">;</span>
		LayoutInflater inflater <span style="color: #339933;">=</span> context.<span style="color: #006633;">getLayoutInflater</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		element <span style="color: #339933;">=</span> inflater.<span style="color: #006633;">inflate</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">personaj</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		TextView nume <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span>element.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">personaj_nume</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		TextView desen <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span>element.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">personaj_desen</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		nume.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>personaje.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nume</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		desen.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>personaje.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">desen</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> element<span style="color: #339933;">;</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;">int</span> getCount <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;">// intaorce nr de elemente din lista</span>
                <span style="color: #000000; font-weight: bold;">return</span> personaje.<span style="color: #006633;">size</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Object</span> getItem<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// intoarce elementul de pe pozitia position din model</span>
		<span style="color: #000000; font-weight: bold;">return</span> personaje.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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;">long</span> getItemId<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> position<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// fiecare element din lista poate avea un id, nu este insa obligatoriu</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> adaugaFunnyGuy <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> nume, <span style="color: #003399;">String</span> desen<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
              Personaj p <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Personaj <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
              p.<span style="color: #006633;">nume</span> <span style="color: #339933;">=</span> nume<span style="color: #339933;">;</span>
              p.<span style="color: #006633;">desen</span> <span style="color: #339933;">=</span> desen<span style="color: #339933;">;</span>
              personaje.<span style="color: #006633;">add</span> <span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
              <span style="color: #666666; font-style: italic;">// acesta functie deterimina adaptorul sa ceara listei sa reafiseze continutul</span>
              <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">notifyDataSetChanged</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ListaDeseneAnimate <span style="color: #000000; font-weight: bold;">extends</span> ListActivity
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// ArrayList&lt;Personaj&gt; personaje; -&gt; mutat in PersonajeAdapter</span>
    PersonajeAdapter adapter<span style="color: #339933;">;</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>Bundle savedInstanceBundle<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    	<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span> <span style="color: #009900;">&#40;</span>savedInstanceBundle<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// personaje = new ArrayList&lt;Personaj&gt;(); -&gt; mutat in Personaje Adapter</span>
        adapter <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PersonajeAdapter <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>
        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>
        setListAdapter <span style="color: #009900;">&#40;</span>adapter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// adaugam cateva personaje in lista</span>
        adapter.<span style="color: #006633;">adaugaFunnyGuy</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bugs Bunny&quot;</span>, <span style="color: #0000ff;">&quot;Looney Toons&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        adapter.<span style="color: #006633;">adaugaFunnyGuy</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Fred Flinstone&quot;</span>, <span style="color: #0000ff;">&quot;The Flinstones&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        adapter.<span style="color: #006633;">adaugaFunnyGuy</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Betty Rubble&quot;</span>, <span style="color: #0000ff;">&quot;The Flinstones&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// pentru a seta actiunea click lung</span>
        getListView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setOnItemLongClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnItemLongClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
		<span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onItemLongClick<span style="color: #009900;">&#40;</span>AdapterView<span style="color: #339933;">&lt;?&gt;</span> listAdapter, <span style="color: #003399;">View</span> view,
					<span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #000066; font-weight: bold;">long</span> id<span style="color: #009900;">&#41;</span> 
			<span style="color: #009900;">&#123;</span>
                                Personaj p <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Personaj<span style="color: #009900;">&#41;</span>adapter.<span style="color: #006633;">getItem</span> <span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>ListaDeseneAnimate.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;click lung pe &quot;</span><span style="color: #339933;">+</span>p.<span style="color: #006633;">nume</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>
				<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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> onListItemClick <span style="color: #009900;">&#40;</span><span style="color: #003399;">ListView</span> list, <span style="color: #003399;">View</span> v, <span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #000066; font-weight: bold;">long</span> id<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// afisam numele personajului pe care s-a dat click folosind un Toast</span>
        Personaj p <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Personaj<span style="color: #009900;">&#41;</span>adapter.<span style="color: #006633;">getItem</span> <span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, p.<span style="color: #006633;">nume</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>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Sunt importante urmatoarele <strong>observatii</strong>:</p>
<ul>
<li>modelul (ArrayList) a fost mutat in adaptor. Acesta este de fapt legatura intre lista si date, deci el este cel care trebuie sa cunoasca datele, si nu fereastra</li>
<li>implementarea functiei <strong>getView()</strong> nu este eficienta, nu este folosit parametrul <em>convertView</em>.</li>
<li>setarea actiunii pentru click-ul lung se face direct pe lista, nu exista o functie in <em>ListActivity </em>ce sa poata fi suprascrisa</li>
</ul>
<p>Implementarea eficienta presupune folosirea parametrului <em>convertView</em>. Acesta este fie null, caz in care trebuie ignorat, fie un obiect intors aterior de catre <strong>getView()</strong>, insa obiect care nu mai este vizibil. Ideea este ca, in loc de a crea un nou <em>View </em>de fiecare data, sa se refoloseasca <em>View-urile</em> create anterior si care nu mai sunt vizibile.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">        @Override
	<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 list<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// functia trebuie sa intoarca view-ul de pe pozitia position din lista</span>
		<span style="color: #666666; font-style: italic;">// convertView este un element din lista ce nu mai este vizibil si poate fi convertit</span>
		<span style="color: #003399;">View</span> element<span style="color: #339933;">;</span>
                <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>
		         LayoutInflater inflater <span style="color: #339933;">=</span> context.<span style="color: #006633;">getLayoutInflater</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		         element <span style="color: #339933;">=</span> inflater.<span style="color: #006633;">inflate</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">personaj</span>, <span style="color: #000066; font-weight: bold;">null</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;">else</span> element <span style="color: #339933;">=</span> convertView<span style="color: #339933;">;</span>
&nbsp;
		TextView nume <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span>element.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">personaj_nume</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		TextView desen <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span>element.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">personaj_desen</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		nume.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>personaje.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nume</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		desen.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>personaje.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">desen</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> element<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In imaginea de mai jos este prezentat modul in care poate arata o lista construita cu <strong>BaseAdapter </strong>(acestea pot fi liste mai complexe, care pot contine eventual alte componente cum ar fi imagini, pentru liste simple construite cu <strong>ArrayAdapter </strong>puteti urmari:  <a href="http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-5.html" title="Invata Sistemul de Operare Android" target="_blank">Invata Sistemul de Operare Android – Partea 5</a>)</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/AndroidList2.png" target="_blank"><img src="http://itassistant.org/pics/AndroidList2.png" alt="Android UI Exemplu" title="Android Base Adapter"/></a>
</div>
<p></p>
<h3> Android &#8211; GridView </h3>
<p></p>
<p><strong>GridView </strong>este o componenta similara cu <strong>ListView</strong>, doar ca afiseaza elementele sub forma unui <em>grid</em>. Functioneaza pe aceelasi principiu ca ListView si foloseste aceelasi tip de adaptor. </p>
<p>Modificarile ce trebuiesc facte sunt:</p>
<ul>
<li>XML-ul fiecarui element din lista, deoarece trebuie tinut cont ca acesta nu mai este singur pe linie, deci trebuie sa aiba o dimensiune limitate</li>
<li>nu se poate folosi <em>ListActivity</em>, fereastra trebuie sa fie una normala. Pentru a atasa adaptorul pe <strong>GridView</strong>, trebuie sa obtineti prima data un pointer catre acesta cu ajutorul functiei <em>getViewById</em>.</li>
</ul>
<h3> Android &#8211; Gallery </h3>
<p></p>
<p><strong>Gallery </strong>este o componenta similara cu <em>ListView</em>, doar ca afiseaza elementele sub forma unui benzi derulante. Functioneaza pe aceelasi principiu ca <em>ListView </em>si foloseste aceelasi tip de adaptor.</p>
<p>Modificarile ce trebuiesc facte sunt:</p>
<ul>
<li>XML-ul fiecarui element din lista, deoarece trebuie tinut cont ca acesta nu mai este singur pe linie, deci trebuie sa aiba o dimensiune limitate</li>
<li>nu se poate folosi <strong>ListActivity</strong>, fereastra trebuie sa fie una normala. Pentru a atasa adaptorul pe <em>Gallery</em>, trebuie sa obtineti prima data un pointer catre acesta cu ajutorul functiei <em>getViewById</em>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-6.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invata Sistemul de Operare Android &#8211; Partea 5</title>
		<link>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-5.html</link>
		<comments>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-5.html#comments</comments>
		<pubDate>Sat, 17 Dec 2011 11:12:53 +0000</pubDate>
		<dc:creator>Ionut</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Activity]]></category>
		<category><![CDATA[ArrayAdapter]]></category>
		<category><![CDATA[ListActivity]]></category>
		<category><![CDATA[ListAdapter]]></category>
		<category><![CDATA[liste]]></category>
		<category><![CDATA[Model View Controller]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://itassistant.org/?p=4563</guid>
		<description><![CDATA[Invata Sistemul de Operare Android - Partea 5 - serie de tutoriale isi propune sa va familiarizeze cu Sistemul de Operare Android astfel incat sa puteti sa scrieti singuri aplicatii pentru propriul SmartPhone.]]></description>
			<content:encoded><![CDATA[<p><img src='http://itassistant.org/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/4563.jpeg&amp;w=230&amp;h=170&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p></p>
<p>Bine ati venit pe ItAssistant. Aceasta noua serie de tutoriale isi propune sa va familiarizeze cu <strong>Sistemul de Operare Android </strong>astfel incat sa puteti sa scrieti singuri <em>aplicatii </em>pentru propriul <strong>SmartPhone</strong>, si de ce nu, aplicatia sa ajunga in top pe <a target="_blank" href="https://market.android.com/" title="Android Market" target="_blank" rel="nofollow"><i>Android</i> Market</a>.</p>
<p>Inainte de a incepe trebuie sa cunoasteti destul de bine limbajul de programare <strong>Java </strong>si conceptele <strong>Programarii Orientata Obiect</strong>; puteti sa aruncati o privire peste tutorialele noastre avansate: <a href="http://itassistant.org/programare/java-programare" title="Invata Java" target="_blank">Invata Java</a></p>
<h2> Android &#8211; Liste </h2>
<p></p>
<p>Astazi ne vom ocupa de implementarea listelor. Sub platforma Android, acestea sunt implementate folosind modelul <strong>MVC (Model View Controller)</strong>. <em>Modelul </em>este reprezentat de datele ce trebuie afisate, <em>View-ul </em>este lista propriu-zisa si <em>Controller-ul</em> este programul care controleaza modul de afisare.</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/List_adapter.png" target="_blank"><img src="http://itassistant.org/pics/List_adapter.png" alt="Android UI Exemplu" title="Android List Adapter"/></a>
</div>
<p></p>
<p>Mai exact vom vorbi despre listele implementate cu <strong>ArrayAdapter</strong> (pentru liste implementate cu <strong>BaseAdapter </strong>puteti urmari <a href="http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-6.html" title="Invata Sistemul de Operare Android" target="_blank">Invata Sistemul de Operare Android – Partea 6</a>).</p>
<h2> ListActivity </h2>
<p></p>
<p>Un <em>View </em>de tip <em>ListView </em>poate fi plasat pe orice tip de activitate (<strong>Activity</strong>). In mod normal, descriem ListView-ul in fisierul XML atasat activitatii, ii dam un id si in codul java luam un pointer catre el (vezi <em>findViewById (R.id.)</em>).</p>
<p>Exista insa un mod mai simplu. In general, pe o activitate exista o singura lista, astfel ca Android ne pune la dispozitie un tip special de activitate, numit <strong>ListActivity</strong>, care rezolva automat preluarea pointer-ului listei. In xml, trebuie declarat obligatoriu un <em>ListView </em>cu id-ul <strong>@android:id/list</strong>.</p>
<p>De asemenea, <em>ListActivity </em>pune la dispozitie urmatoarele functii:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// seteaza adaptorul pentru lista de pe ferastra</span>
<span style="color: #000066; font-weight: bold;">void</span> setListAdapter <span style="color: #009900;">&#40;</span>ListAdapater adapter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// intoarce adaptorul listei de pe fereastra</span>
ListAdapter getListAdapter <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// intoarce un pointer catre lista din fereastra</span>
<span style="color: #003399;">ListView</span> getListView <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>O alta functie oferita de catre ListActivity este <strong>onListItemClick()</strong>. Acesta este apelata automat de fiecare data cand se executa un click asupra unui element din lista. Initial functia este vida, in alte cuvinte, nu face nimic. Pentru a-i adauga o actiune, programatorul trebuie sa suprascrie acesta functie.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onListItemClick <span style="color: #009900;">&#40;</span><span style="color: #003399;">ListView</span> list, <span style="color: #003399;">View</span> v, <span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #000066; font-weight: bold;">long</span> id<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// list - este lista de pe fereastra</span>
        <span style="color: #666666; font-style: italic;">// v - este elementul din lista pe care s-a dat click</span>
        <span style="color: #666666; font-style: italic;">// position - este pozitia pe care s-a dat click (de fapt pozitia la care se afla elementul v in lista)</span>
        <span style="color: #666666; font-style: italic;">// id - este id-ul elementului (obtinut prin functia getItemId () a adaptorului	</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<h2> ListAdapter </h2>
<p></p>
<p>In <strong>Android</strong>, lista este de fapt un ScrollView vertical. Sarcina programatorlui este de fapt crearea componentelor <em>View </em>pentru fiecare linie din acest ScrollView. In alte cuvinte, daca ne uitam la poza de mai sus, ceea ce trebuie noi sa facem este sa scriem componenta Adapter. Din punct de vedere ar programarii, asta inseamna crearea unui obiect care sa implementeze interfata <strong>ListAdapater</strong>.</p>
<p>Biblioteciile Android ne pun la dispozitie mai multe variante de a implmenta ListAdapter.</p>
<h3> Android &#8211; ArrayAdapter </h3>
<p></p>
<p>Pentru lista simple, ce contin element cu o singura linie de text se poate folosi o clasa mult simplificata, si anume <strong>ArrayAdapter</strong>. Acesta presupune ca toate elementele sunt stocate intr-un sir (ex: Object[]) sau o lista (orice obiect ce implementeaza interfata <em>List</em>).</p>
<p>Deoarece fiecare element din lista este o linie de text si in sir sau lista noi pastram obiecte, adaptorul va apela functia <em>toString()</em> pe fiecare obiect.</p>
<p>Un exemplu de folosire este urmatorul:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Personaj
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> nume<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> desen<span style="color: #339933;">;</span>
&nbsp;
    @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: #666666; font-style: italic;">// acesta functie este apelata de catre ArrayAdapter pentru a transforma obiectul intr-un String ce</span>
        <span style="color: #666666; font-style: italic;">// sa fie afisat in lista</span>
        <span style="color: #000000; font-weight: bold;">return</span> nume<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; din desenul animat &quot;</span><span style="color: #339933;">+</span>desen<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ListaDeseneAnimate <span style="color: #000000; font-weight: bold;">extends</span> ListActivity
<span style="color: #009900;">&#123;</span>
    ArrayList<span style="color: #339933;">&lt;</span>Personaj<span style="color: #339933;">&gt;</span> personaje<span style="color: #339933;">;</span>
    ArrayAdapter<span style="color: #339933;">&lt;</span>Personaj<span style="color: #339933;">&gt;</span> adapter<span style="color: #339933;">;</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>Bundle savedInstanceBundle<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    	<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span> <span style="color: #009900;">&#40;</span>savedInstanceBundle<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        personaje <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Personaj<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        adapter <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayAdapter<span style="color: #339933;">&lt;</span>Personaj<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, android.<span style="color: #006633;">R</span>.<span style="color: #006633;">layout</span>.<span style="color: #006633;">simple_list_item_1</span>, personaje<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        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>
        setListAdapter <span style="color: #009900;">&#40;</span>adapter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// adaugam cateva personaje in lista</span>
        adaugaFunnyGuy<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bugs Bunny&quot;</span>, <span style="color: #0000ff;">&quot;Looney Toons&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        adaugaFunnyGuy<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Fred Flinstone&quot;</span>, <span style="color: #0000ff;">&quot;The Flinstones&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        adaugaFunnyGuy<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Betty Rubble&quot;</span>, <span style="color: #0000ff;">&quot;The Flinstones&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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> onListItemClick <span style="color: #009900;">&#40;</span><span style="color: #003399;">ListView</span> list, <span style="color: #003399;">View</span> v, <span style="color: #000066; font-weight: bold;">int</span> position, <span style="color: #000066; font-weight: bold;">long</span> id<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// afisam numele personajului pe care s-a dat click folosind un Toast</span>
        Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>ListaDeseneAnimate.<span style="color: #000000; font-weight: bold;">this</span>, personaje.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nume</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>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> adaugaFunnyGuy <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> nume, <span style="color: #003399;">String</span> desen<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        Personaj p <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Personaj <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        p.<span style="color: #006633;">nume</span> <span style="color: #339933;">=</span> nume<span style="color: #339933;">;</span>
        p.<span style="color: #006633;">desen</span> <span style="color: #339933;">=</span> desen<span style="color: #339933;">;</span>
        personaje.<span style="color: #006633;">add</span> <span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// acesta functie deterimina adaptorul sa ceara listei sa reafiseze continutul</span>
        adapter.<span style="color: #006633;">notifyDataSetChanged</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In imaginea de mai jos este prezentat modul in care va arata o lista construita cu <strong>ArrayAdapter </strong>(dupa cum am precizat, sunt liste simple, doar cu text; pentru liste mai complexe puteti urmari <a href="http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-6.html" title="Invata Sistemul de Operare Android" target="_blank">Invata Sistemul de Operare Android – Partea 6</a>).</p>
<div style="text-align: center">
<a href="http://itassistant.org/pics/AndroidList1.png" target="_blank"><img src="http://itassistant.org/pics/AndroidList1.png" alt="Android UI Exemplu" title="Android Array Adapter"/></a>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://itassistant.org/programare/android/invata-sistemul-de-operare-android-partea-5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

