Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android 04 - Persistência Local & SplashScreen

790 views

Published on

Persistencia de dados com SharedPreferences e Sugar Library

Published in: Mobile
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • If you want to download or read this book, copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Android 04 - Persistência Local & SplashScreen

  1. 1. Desenvolvimento Android Aline Borges alinekborges@gmail.com
  2. 2. Slides • Esta apresentação está disponível em: http://bit.ly/android04_bancodedados Trechos de códigos serão disponíveis em: www.codeshare.io/lyhtt
  3. 3. Objetivo • Singleton • Salvar dados locais • Carregar dados iniciais em uma SplashScreen
  4. 4. Singleton App
  5. 5. Singleton • Permite apenas uma instância • Salva instâncias “globais” para o aplicativo inteiro • Usuário logado • Booleans de preferencias • etc
  6. 6. Objetivo • Salvar se é a primeira vez que o usuário utiliza o aplicativo • (por exemplo, para mostrar um tutorial ou pular o login quando for a segunda vez em diante que abrir o aplicativo)
  7. 7. Primeira vez
  8. 8. SharedPreferences • Dados primitivos do tipo key, value • String, boolean, int, etc • Dados mais “simples”
  9. 9. SharedPreferences • Por exemplo • Key, value • “user”, “alinekb” • “senha”, “xxxx” • “notificacoes”, true • “idade”, 22
  10. 10. Classe SharedPrefs • Variável final para a key da preference
  11. 11. SharedPrefs • Método estático pois não é de um “objeto”, é apenas uma função para organização
  12. 12. SharedPrefs
  13. 13. Main Activity • Buscar se a variável isLoggedIn é true or false
  14. 14. SplashScreen • Usada para carregar valores iniciais • Mostrar alguma logo ou animação • Não demore muito na splash screen, não teste a paciência do seu usuário
  15. 15. SplashScreen • Nova Activity - SplashScreen
  16. 16. SplashScreen
  17. 17. SplashScreen
  18. 18. Manifest.xml • Alterar a Activity principal • Tirar o intent-filter da MainActivity e passar para a SplashScreen
  19. 19. SplashScreen • Pode ser usada agora para carregar a informação da SharedPreferences enquanto está carregando
  20. 20. SharedPreferences • Salvando objetos complexos • Serialização com GSON
  21. 21. Salvando objetos complexos
  22. 22. Recuperando a lista
  23. 23. Padrão • 3G é um recurso limitado e lento, então o melhor é sempre guardar tudo em memória interna
  24. 24. Testando • Na primeira vez que os objetos são baixados, gravar a lista nas Shared Preferences • Nas próximas vezes, carregar das SharedPreferences
  25. 25. Database com Sugar ORM • Biblioteca para facilitar uso de banco de dados • compile 'com.github.satyan:sugar:1.3‘ • http://satyan.github.io/sugar/getting- started.html
  26. 26. AndroidManifest.xml
  27. 27. Sugar ORM
  28. 28. Operações básicas
  29. 29. Operações básicas
  30. 30. Crouton
  31. 31. Bibliotecas legais • Crouton • compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') { • exclude group: 'com.google.android', module: 'support-v4' • } • Mensagens de forma agradável
  32. 32. • Alerta • Confirm • Info
  33. 33. Obrigada! • Aline K Borges • alinekborges@gmail.com

×