Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Execução de Thread

Antes eu usava Handler também, depois que tive que começar a fazer para 3.0+ , mesmo que eu não atualize a minha View, qualquer requisição Http faço comAsyncTask..


Abraço

Em 29 de janeiro de 2013 17:05, Diogo Henrique <diogjp10@gmail.com> escreveu:
new Thread.run(){
// não seria assim não ?
}

Diogo Henrique
Rede Sociais: 






Em 29 de janeiro de 2013 15:36, Diego N. <diegonunes.sistema@gmail.com> escreveu:

Valeu Jonas.

Você tem alguma referencia de como posso colocar essa execução em outra thread, como a AsyncTask?

Att,


2013/1/29 Jonas Alves <jonasfa@gmail.com>
Essa exception significa que, ao contrário do que você afirma, seu app não "executa uma thread".

A solução é bem simples: execute suas operações de rede em outra thread.
Dica: um Handler sempre executa suas tarefas na Thread em que ele foi criado. Ou seja, você deve criar o seu Handler em outra Thread.


2013/1/29 Diego N. <diegonunes.sistema@gmail.com>
Boa tarde Pessoal.

Preciso de tempos em tempo fazer uma verificação em um servidor, não estou utilizando AsyncTask pois não preciso fazer nenhuma atualização da minha view.

Então utilizei um Handler que executa uma thread de tempos em tempos, e essa thread faz acesso ao servidor. Nas versões Honeycomb para baixo está rodando blz, já nas superiores recebo uma exception: android.os.NetworkOnMainThreadException.

Alguém usa alguma estratégia diferente para fazer este tipo de tarefa?

Obrigado.

Att,

--

Diêgo Nunes Assunção
"Give Peace a Chance"

--
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/groups/opt_out.
 
 



--
Jonas Alves

--
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/groups/opt_out.
 
 



--

Diêgo Nunes Assunção
"Give Peace a Chance"

--
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/groups/opt_out.
 
 

--
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/groups/opt_out.
 
 



--
Att,
Gabriel Augusto
013 97940055

--
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/groups/opt_out.
 
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário