Introduction to Android | Android Tutorials | Android Blog - SearchforSolut...
Android FREETEC
-
Upload
nelson-glauber-leal -
Category
Technology
-
view
549 -
download
0
Transcript of Android FREETEC
Desenvolvimento AndroidFaça da maneira certa!
Freetec / Julho 2015
+Nelson Glauber@nglauber www.nglauber.com.br
Nelson GlauberEngenheiro de Sistemas do C.E.S.A.R.
Professor da Unibratec Android GDE
Intel Innovator
@nglauber +NelsonGlauber
ww.nglauber.com.br
http://goo.gl/V7qHc
“Android is a software stack for mobile devices that includes an operating system,
middleware and key applications. The Android SDK provides the tools and APIs
necessary to begin developing applications on the Android platform using the Java
programming language.”
Os sabores do Android
1.5 - 3 1.6 - 4 2.0/2.1 - 6/7 2.2 - 8 2.3 - 9/10
3.0/3.1/3.2 11/12/13 4.0 - 14/15 4.1/4.2/4.3
16/17/18 4.4 - 19 5.0/5.121/22
Suporte a múltiplas telas
• Tamanho: é a área física de tela em polegadas
• Densidade: quantidade de pixels por polegada
• Resolução: quantidade de pixels na tela
http://goo.gl/cMGs
<Button android:layout_width="100px" android:layout_height="100px" ... />
Não use px, use dp (ou dip)
<Button android:layout_width="100dp" android:layout_height="100dp" ... />
Use dp para margin e padding<LinearLayout ...> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Margin" android:background="#FFFF00" android:layout_margin="40dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Padding" android:background="#00FF00" android:padding="40dp"/> </LinearLayout>
Defina imagens para cada densidade
res/drawable-mdpi res/drawable-tvdpi res/drawable-hdpi res/drawable-xhdpi res/drawable-xxhdpi res/drawable-xxxhdpi
http://goo.gl/E70Ez
Personalize componentes com selectors
http://goo.gl/5AiEM
<selector ...> <item android:state_pressed="true" android:drawable="@drawable/botao_pressionado"/> <item android:state_enabled="false" android:drawable="@drawable/botao_desabilitado"/> <item android:drawable="@drawable/botao_normal"/> </selector>
botao_pressionado.9.pngbotao_normal.9.png botao_desabilitado.9.png
Fale outros idiomas<string name="hello"> Hello World </string>
res/values
<string name="hello"> Olá mundo </string>
res/values-pt
<TextView android:text=“Hello World" ... />
<string name="hello"> Hola mundo </string>
res/values-es
http://goo.gl/JAuu
<TextView android:text="@string/hello" ... />
Não diga como o usuário deve segurar o aparelho*
res/layout res/layout-land
* Salvo algumas exceções http://goo.gl/sMhD5
Salve seus dados!• SharedPreferences para pequenas coisas
• SQLite para trabalhar off-line
• CursorLoader + ContentProvider + CursorAdapter
http://goo.gl/xkXp
Trabalhe em background!
• Nunca trave a UI! 60FPS é sua meta!
• Use AsyncTask
• Use IntentService
• Use SyncAdapter
SyncAdapterActivity Cursor Adapter
Content Provider
ProcessorREST Method
SyncAdapter
query, insert, delete, update
3. GET, PUT, POST, DELETE
1. Itens a serem sincronizados
2. Sincroniza com o servidor
4. Processa os dados
5. Atualiza banco local
https://goo.gl/rnF9JZ
Use libs! Com é lindo!
dependencies { ... compile ‘com.squareup:otto:1.3.5' compile ‘com.squareup.okhttp:okhttp:2.2.0' compile ‘com.squareup.retrofit:retrofit:1.9.0' compile ‘com.squareup.picasso:picasso:2.4.0' compile ‘com.jakewharton:butterknife:6.0.0' compile 'com.jakewharton.timber:timber:2.5.1'}