Programació Android 2
-
Upload
marcsolerandroid -
Category
Education
-
view
199 -
download
8
description
Transcript of Programació Android 2
![Page 1: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/1.jpg)
Programació d'aplicacions per a Smartphones: Android
• 2ª Sessió
![Page 2: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/2.jpg)
Estructura d’un ProjecteProgramació d'aplicacions per a Smartphones:
Android
• SRC: El codi font del projecte, paquetitzat.
• GEN: Codi auto generat per ADT d’Android, com ara el fitxer R.java.
• BIN: Objectes Compilats despres del build. Aqui podem trobar el fitxer d’instal·lació apk.
• RES: Recursos. El contingut multimedia del projecte com ara imatges (drawables) pantalles (layouts) i textos (Strings.)
• AndroidManifest.xml: Meta-Informació del projecte. La informació de les activitats i els permisos de l’aplicació.
![Page 3: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/3.jpg)
Estructura d’un ProjecteProgramació d'aplicacions per a Smartphones:
Android
• Drawable: Imatges. En diferents resolucions en funció de la compatibilitat de l’aplicació.
• Layout: Maquetització de les pantalles. En format XML.
• Values: Altres recursos com ara cadenes i estils en format de fitxers XML.
• Menu: Fitxer de configruació dels submenus.
• Colors: colors en format Hexadecimal.
• Raw: Contingut multimedia
• Anim: Animacions.
![Page 4: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/4.jpg)
Estructura d’un ProjecteProgramació d'aplicacions per a Smartphones:
Android
• JNI: Codi natiu per projectes que ho requereixin.
• ASSESTS: Directory buit per enmagatzemar fitxers de contingut multimedia, com ara textures i dades de jocs.
• LIBS: Llibreries Privades.
• Project.propieties: Configuració del projecte com ara la versió del build. Per editar-lo seleccionar el projecte amb el botó dret i escollir propietats.
![Page 5: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/5.jpg)
BlocsProgramació d'aplicacions per a Smartphones:
Android
Activities Cada activity és una sola pantalla en l’aplicació, amb suport per Java I que deriva de la classe
Activity. Tipicament ocupa la pantalla completa, pero podria ser flotant o transparent. Pot rebre i manejar esdeveniments UI i realitzar tasques complexes.
Broadcast Intent Receivers Una classe de l’aplicació que escolta Intents que son emesos, en lloc d’esperar d’un sol fil de
comunicació. El sistema envia una petició a tots els broadcast que puguin estar interessats I aquests actuen sequencialment.
Content Providers Un capa de comunicació que permet a la teva aplicacó es comuniqui amb altres aplicacions.
Normalment s’utilitza per passar contingut de tipus String entre aplicacions.
Services Un objecte de la classe Service, que s’executa en segon pla, no conte interficie gràfica,
permet l’execucuio de tasques persistents com escoltar musica o monitoritzar processos de xarxa.
![Page 6: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/6.jpg)
Cicle de VidaProgramació d'aplicacions per a Smartphones:
Android
![Page 7: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/7.jpg)
AndroidProgramació d'aplicacions per a Smartphones:
Android
Estructura Projecte
•Exercici Activities & Lifecycle
![Page 8: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/8.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Es tracta d’un objecte/Missatge que és pot utilitzar per llençar o comunicar amb altres aplicacions/activitats de forma asíncrona. Pot contenir certs criteris de comunicació, rebre resultats, o contenir informació. Pot llençar una activitat o un broadcast intent.
![Page 9: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/9.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Destinetari: Qui volem que rebi l’intent?
![Page 10: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/10.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Acció: Text indican l’acció a realitzar
![Page 11: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/11.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Dades: URI sobre les dades que és realitzarà l’acció.
![Page 12: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/12.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Tipus de Dades (Opcional): Tipus MIME de les dades.
![Page 13: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/13.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Categoria: El tipus de component que pot processar l’intent, en pot tenir mes d’una.
![Page 14: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/14.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Extres: mapa, clau-valor, per informació adicional
![Page 15: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/15.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Flags: Indiquen el comportament quant s’até la petició.
![Page 16: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/16.jpg)
IntentsProgramació d'aplicacions per a Smartphones:
Android
Qui realitzarà l’acció?
Quina acció realitzarem?
Com realitzarem l’acció?
![Page 17: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/17.jpg)
ReceiversProgramació d'aplicacions per a Smartphones:
Android
![Page 18: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/18.jpg)
ReceiversProgramació d'aplicacions per a Smartphones:
Android
![Page 19: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/19.jpg)
ReceiversProgramació d'aplicacions per a Smartphones:
Android
![Page 20: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/20.jpg)
AndroidProgramació d'aplicacions per a Smartphones:
Android
•Exercici Intents
![Page 21: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/21.jpg)
Broadcast Intent ReciverProgramació d'aplicacions per a Smartphones:
Android
![Page 22: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/22.jpg)
ServicesProgramació d'aplicacions per a Smartphones:
Android
![Page 23: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/23.jpg)
Content ProvidersProgramació d'aplicacions per a Smartphones:
Android
![Page 24: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/24.jpg)
AndroidProgramació d'aplicacions per a Smartphones:
Android
•Exercici Services
![Page 25: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/25.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 26: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/26.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 27: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/27.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 28: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/28.jpg)
Programació d'aplicacions per a Smartphones: AndroidInterface Gràfica
![Page 29: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/29.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 30: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/30.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 31: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/31.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 32: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/32.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 33: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/33.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 34: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/34.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 35: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/35.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 36: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/36.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 37: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/37.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 38: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/38.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 39: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/39.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 40: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/40.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 41: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/41.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 42: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/42.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 43: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/43.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 44: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/44.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 45: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/45.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 46: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/46.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 47: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/47.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 48: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/48.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 49: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/49.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 50: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/50.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 51: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/51.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 52: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/52.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 53: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/53.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 54: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/54.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 55: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/55.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 56: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/56.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 57: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/57.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 58: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/58.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 59: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/59.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 60: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/60.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 61: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/61.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 62: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/62.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 63: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/63.jpg)
Interface GràficaProgramació d'aplicacions per a Smartphones:
Android
![Page 64: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/64.jpg)
AndroidProgramació d'aplicacions per a Smartphones:
Android
•Exercici Layouts
![Page 65: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/65.jpg)
RecursosProgramació d'aplicacions per a Smartphones:
Android
![Page 66: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/66.jpg)
RecursosProgramació d'aplicacions per a Smartphones:
Android
![Page 67: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/67.jpg)
RecursosProgramació d'aplicacions per a Smartphones:
Android
![Page 68: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/68.jpg)
RecursosProgramació d'aplicacions per a Smartphones:
Android
![Page 69: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/69.jpg)
RecursosProgramació d'aplicacions per a Smartphones:
Android
![Page 70: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/70.jpg)
RecursosProgramació d'aplicacions per a Smartphones:
Android
![Page 71: Programació Android 2](https://reader038.fdocuments.ec/reader038/viewer/2022102717/557b850cd8b42a62418b47c4/html5/thumbnails/71.jpg)
AndroidProgramació d'aplicacions per a Smartphones:
Android
•Exercici Resources