Sim.
Valeu @geovanisouza92
Valeu @geovanisouza92
Em 19 de fevereiro de 2015 16:54, geovanisouza92@gmail.com <geovanisouza92@gmail.com> escreveu:
Adoro quando a resposta vêm sozinha! kkkkkSó não esqueça de de-registrar sua Activity no onServiceDisconnected(), ativado através do Context#unbindService(), senão vc pode ser pego por NPE.Em 19 de fevereiro de 2015 16:50, Gink Labrev <gink.labrev@gmail.com> escreveu:Ah foi mal.Não me liguei. Depois de obter a referência ao serviço, seria só chamar um método do tipo service.setActivity(this);Valeu !!!Em 19 de fevereiro de 2015 16:42, Gink Labrev <gink.labrev@gmail.com> escreveu:Obrigado pela resposta Geovani.Mas não entendi bem seu ponto em relação ao ServiceConnectionUma instância de ServiceConnection é passado por parâmetro para o método bindService() da Activity.Esse método retorna no callback onServiceConnected() o binder do Service. E atráves do binder, posso obter a referência ao serviço.Não vejo aonde ou como registrar a Activity no Service no esquema acima.2015-02-19 15:33 GMT-02:00 Geovani **Leia a documentação oficial** de Souza <geovanisouza92@gmail.com>:Vc também pode criar um interface, fazer sua Activity implementar ela e usar a ServiceConnection para registrar/deregistrar a Activity no serviço, seguindo um Design Pattern Publisher & Subscriber (também conhecido como Observer).--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/androidbrasil-dev/o6WL1nebyGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--@geovanisouza92 - Geovani de Souza--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.






0 comentários:
Postar um comentário