sete o ID, ou objeto do pedido como tag do Button... e no onClick é só buscar o tag
Lúcio Maciel
luciofm@gmail.com
luciofm@gmail.com
2014-04-24 16:01 GMT-03:00 Felipe Aron <felipearon@gmail.com>:
Acho que me expressei mal @luciofm.Até ai tudo dominado, porém o "problema" é:Meu adapter mostra uma lista de pedidos. Cada pedido possui seu Id/Pk. Preciso pegar esse Id e usar lá dentro do click do botão. Como saber qual é o Id do pedido?Em 24 de abril de 2014 15:46, luciofm <luciofm@gmail.com> escreveu:Ué, é o id que está no XMLpublic View getView(int position, View convertView, final ViewGroup parent) { View v = convertView; ViewHolder holder; if (convertView == null) { v = inflater.inflate(R.layout.adapter_user, parent, null); holder = new ViewHolder(v); } else { v = (ViewHolder) v.getTag(); } /* Código do adapter */ return v;}Lúcio Maciel
luciofm@gmail.com2014-04-24 15:40 GMT-03:00 Felipe Aron <felipearon@gmail.com>:Sim, uso.Em 24 de abril de 2014 15:36, luciofm <luciofm@gmail.com> escreveu:
Não usa um inflate em um XML?Lúcio Maciel
luciofm@gmail.com2014-04-24 15:35 GMT-03:00 Felipe Aron <felipearon@gmail.com>:Legal, foi o que pensei. Mas preciso do "ID" do objeto na lista. Como passar isso ao evento click?2014-04-24 15:20 GMT-03:00 luciofm <luciofm@gmail.com>:
class ViewHolder {public ViewHolder(View v) {Butterknife.inject(this, v);v.setTag(this);}@OnClick(R.id.button)public void onClick(Button btn) {}}--Lúcio Maciel
luciofm@gmail.com2014-04-24 14:31 GMT-03:00 Felipe Aron <felipearon@gmail.com>:--Galera, to usando o ButterKnife pra auxiliar na diminuição e simplicidade de código.Tem funcionado perfeitamente bem.Porém pintou uma dúvida:Dentro do BaseAdapter, como criar o "click" de um botão?Até hoje eu faço o evento clickListener() dentro do getView():holder.btnDetail.setOnClickListener(...)É possível usar a annotation "@OnClick" do ButterKnife nesse caso? Como?--Programador
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.
--
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.
--
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.
--
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