Your SlideShare is downloading. ×
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

[Android devcamp] Android Bootcamp – 2012

786

Published on

Básico de Android apresentado no Bootcamp promovido pelo GTUG Campinas em conjunto com GTUG São Paulo

Básico de Android apresentado no Bootcamp promovido pelo GTUG Campinas em conjunto com GTUG São Paulo

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
786
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Android Bootcamp Douglas Drumond! drumond.douglas@gmail.com
  • 2. eu.about()
  • 3. eu.about() • Técnico
  • 4. eu.about() • Técnico • (pseudo)Matemático
  • 5. eu.about() • Técnico • (pseudo)Matemático • Bacharel em Ciência da Computação
  • 6. eu.about() • Técnico • (pseudo)Matemático • Bacharel em Ciência da Computação • Analista de software no Instituto de Pesquisas Eldorado
  • 7. @Eldorado Aplicações Framework Bibliotecas Linux Kernel Dalvik
  • 8. @Eldorado Aplicações Framework Bibliotecas Linux Kernel Dalvik BP
  • 9. Hoje http://www.flickr.com/photos/natalielucier/3619749009/
  • 10. http://www.gtugs.org/
  • 11. http://www.flickr.com/photos/donkeyhotey/5666071828/
  • 12. Ferramentas
  • 13. Pré-requisitos • JDK! • Android SDK
  • 14. Sistema Operacional • Linux! • Mac OS X (Intel)! • Windows XP ou superior
  • 15. Ferramentas
  • 16. Ferramentas
  • 17. Ferramentas
  • 18. Ferramentas
  • 19. Ferramentas
  • 20. Ferramentas • Remote debugger • logcat • DDMS
  • 21. Ferramentas
  • 22. Ferramentas
  • 23. Ferramentas
  • 24. Ferramentas
  • 25. Ferramentas
  • 26. Livre • the definition of open: "mkdir android ; cd android ; repo init -u git:// android.git.kernel.org/platform/manifest.git ; repo sync ; make" http://twitter.com/#!/arubin/status/27808662429
  • 27. Arquitetura
  • 28. Arquitetura Linux Kernel
  • 29. Arquitetura Bibliotecas Linux Kernel Dalvik
  • 30. Arquitetura Framework Bibliotecas Linux Kernel Dalvik
  • 31. Arquitetura Aplicações Framework Bibliotecas Linux Kernel Dalvik
  • 32. Arquitetura Aplicações Framework Bibliotecas Linux Kernel Dalvik
  • 33. Dissecando as Aplicações
  • 34. Activity
  • 35. Service
  • 36. Content Provider
  • 37. Intent
  • 38. Intent
  • 39. Intent
  • 40. Intent
  • 41. Intent
  • 42. Broadcast Receiver • Não possui interface (com usuário)! • Roda em segundo plano! • Reage a mensagens de broadcast! • Exemplo: carga de bateria
  • 43. Activity • Interface! • Um objetivo! • Várias por aplicativo! • Pode iniciar outras activities
  • 44. Activity • 3 estados: ativa, em pausa e parada! • 3 ciclos de vida! • pode morrer a qualquer momento se não estiver ativa
  • 45. Activity
  • 46. Activity onCreate()
  • 47. Activity onCreate() onStart()
  • 48. Activity onCreate() onStart() onResume()
  • 49. Activity onCreate() onStart() onResume() em execução
  • 50. Activity onCreate() onStart() onResume() em execução onPause()
  • 51. Activity onCreate() onStart() onResume() em execução onPause()
  • 52. Activity onCreate() onStart() Primeiro plano onResume() em execução onPause()
  • 53. Activity onCreate() onStart() Primeiro plano onResume() em execução onPause() onStop()
  • 54. Activity onCreate() onStart() Primeiro plano onResume() em execução onPause() onStop() onRestart()
  • 55. Activity onCreate() onStart() Primeiro plano onResume() em execução onPause() onStop() onRestart()
  • 56. Activity onCreate() Visível onStart() Primeiro plano onResume() em execução onPause() onStop() onRestart()
  • 57. Activity onCreate() Visível onStart() Primeiro plano onResume() em execução onPause() onStop() onDestroy() onRestart()
  • 58. Activity onCreate() Visível onStart() Primeiro plano onResume() em execução onPause() onStop() onDestroy() shutdown onRestart()
  • 59. Activity Ciclo de vida completo onCreate() Visível onStart() Primeiro plano onResume() em execução onPause() onStop() onDestroy() shutdown onRestart()
  • 60. Multitarefa
  • 61. Multitarefa
  • 62. Multitarefa onCreate()
  • 63. Multitarefa onPause()
  • 64. Multitarefa
  • 65. Multitarefa onResume()
  • 66. Multitarefa onPause()
  • 67. Multitarefa onStop()
  • 68. Multitarefa onStop() onCreate()
  • 69. Multitarefa onStop() onCreate() onPause()
  • 70. Multitarefa onStop() onCreate() onPause() onStop()
  • 71. Multitarefa onStop() onCreate() onPause() onStop()
  • 72. Multitarefa onStop() onCreate() onPause() onStop() onCreate()
  • 73. Multitarefa onStop() onCreate() onRestart() onPause() onStop() onCreate()
  • 74. Multitarefa onStop() onCreate() onRestart() onPause() onStart() onStop() onCreate()
  • 75. Prática • Criar uma aplicação com os métodos onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy() e onRestart()! • Colocar logs nesses métodos e observar o que acontece
  • 76. UI • Hierarquia de ViewGroups e Views
  • 77. View Group View Group View View View View View http://developer.android.com/guide/topics/ui/how-androiddraws.html
  • 78. Layout <?xml&version="1.0"&encoding="utf98"?>& <LinearLayout&xmlns:android="http://schemas.android.com/apk/res/ android"& &&&&&&&&&&&&&&android:layout_width="match_parent"&& &&&&&&&&&&&&&&android:layout_height="match_parent"&& &&&&&&&&&&&&&&android:orientation="vertical"&>& &&&&<TextView&android:id="@+id/text"& &&&&&&&&&&&&&&android:layout_width="wrap_content"& &&&&&&&&&&&&&&android:layout_height="wrap_content"& &&&&&&&&&&&&&&android:text="Hello,&I&am&a&TextView"&/>& &&&&<Button&android:id="@+id/my_button"& &&&&&&&&&&&&android:layout_width="wrap_content"& &&&&&&&&&&&&android:layout_height="wrap_content"& &&&&&&&&&&&&android:text="Hello,&I&am&a&Button"&/>& </LinearLayout>& http://developer.android.com/
  • 79. Layout public&void&onCreate(Bundle&savedInstanceState)&{& &&&&super.onCreate(savedInstanceState);& &&&&setContentView(R.layout.main_layout);& } Button&myButton&=&(Button)&findViewById(R.id.my_button); http://developer.android.com/
  • 80. Layout • FrameLayout! • LinearLayout! • TableLayout! • RelativeLayout
  • 81. Eventos • Definir um listener e registrá-lo com a View! • Sobrecarregar um método de callback na View
  • 82. Listeners • onClick() → View.OnClickListener! • onLongClick() → View.OnLongClickListener! • onFocusChange() → View.OnFocusChangeListener! • onKey() → View.OnKeyListener! • onTouch() → View.OnTouchListener! • onCreateContextMenu() → View.OnCreateContextMenuListener
  • 83. Listeners //&Create&an&anonymous&implementation&of&OnClickListener& private&OnClickListener&mCorkyListener&=&new&OnClickListener()&{& &&&&public&void&onClick(View&v)&{& &&&&&&//&do&something&when&the&button&is&clicked& &&&&}& };& ! protected&void&onCreate(Bundle&savedValues)&{& &&&&...& &&&&//&Capture&our&button&from&layout& &&&&Button&button&=&(Button)findViewById(R.id.corky);& &&&&//&Register&the&onClick&listener&with&the&implementation&above& &&&&button.setOnClickListener(mCorkyListener);& &&&&...& }& http://developer.android.com/
  • 84. Listeners public&class&ExampleActivity&extends&Activity&implements& OnClickListener&{& &&&&protected&void&onCreate(Bundle&savedValues)&{& &&&&&&&&...& &&&&&&&&Button&button&=&(Button)findViewById(R.id.corky);& &&&&&&&&button.setOnClickListener(this);& &&&&}& ! &&&&//&Implement&the&OnClickListener&callback& &&&&public&void&onClick(View&v)&{& &&&&&&//&do&something&when&the&button&is&clicked& &&&&}& &&&&...& } http://developer.android.com/
  • 85. Intents • Comunicação intra e inter app de um jeito amigável e inteligente! • Serve para iniciar activities, services e broadcast receivers
  • 86. Intents • Possui um alvo facultativo! • Se não tiver especificado alvo, o sistema encontra um! • Pode executar uma Activity ou Service específico! • IntentFilters
  • 87. Intents • Component name! • Action! • Data! • Category! • Extras! • Flags
  • 88. Intents Constante Alvo Ação ACTION_CALL activity Inicia uma ligação ACTION_EDIT activity Apresenta dados a serem editados ACTION_MAIN activity Activity inicial ACTION_SYNC activity Sincroniza dados com servidor ACTION_BATTERY_LOW broadcast receiver Aviso de bateria fraca ACTION_HEADSET_PLUG broadcast receiver Um fone de ouvido foi conectado ou desconectado ACTION_SCREEN_ON broadcast receiver A tela foi ligada (acesa) ACTION_TIMEZONE_CHANGED broadcast receiver Configurações de timezone modificadas
  • 89. Intent filter <intent9filter&.&.&.&>& &&&&<action&android:name="com.example.project.SHOW_CURRENT"&/>& &&&&<action&android:name="com.example.project.SHOW_RECENT"&/>& &&&&<action&android:name="com.example.project.SHOW_PENDING"&/>& &&&&.&.&.& </intent9filter> <intent9filter&.&.&.&>& &&&&<data&android:mimeType="video/mpeg"& android:scheme="http"&.&.&.&/>&& &&&&<data&android:mimeType="audio/mpeg"& android:scheme="http"&.&.&.&/>& &&&&.&.&.& </intent9filter> http://developer.android.com/
  • 90. http://developer.android.com/ ! http://developer.android.com/ resources/browser.html?tag=tutorial
  • 91. www.slideshare.net/ douglasdrumond/
  • 92. Obrigado

×