android - Refresh ListView pressing option DialogFragment -
i have listview clicking on element shows dialogfragmen several options, options take user shown in item of listview textview , following error in execution:
activity app.gepv.inventario has leaked intentreceiver com.immersion.android.haptics.hapticfeedbackmanager$hapticfeedbackbroadcastreceiver@426e94b8 registered here. missing call unregisterreceiver()?
enter code think important, if need else edit question :)
this mi dialogfragment:
final string[] items= equidisp.toarray(new string[equidisp.size()]); alertdialog.builder builder = new alertdialog.builder(getactivity()); builder.settitle("asigne equipo/equipos:") .setonkeylistener(new dialog.onkeylistener(){ public boolean onkey(dialoginterface arg0, int keycode,keyevent event) { // todo auto-generated method stub if (keycode == keyevent.keycode_back) { finish(); //dialog.dismiss(); actualizardisplay(); } return true; } }) .setmultichoiceitems(items, null, new dialoginterface.onmultichoiceclicklistener() { public void onclick(dialoginterface dialog, int item, boolean ischecked) { log.i("dialogos", "opciĆ³n elegida: " + items[item]); if(ischecked) { marcado.add(items[item]); log.i("dialogos", "marcado: " + items[item]); obras.get(pulsado).equia.add(integer.parseint(items[item])); for( int k=0; k< obras.get(pulsado).equia.size(); k++) { log.i("dialogos", "equipos: " + obras.get(pulsado).equia.get(k) ); } } } });
so far running because check log.i
this function actualizardisplay():
public void actualizardisplay() { adapter = new obrasadapter(this, obras); lvobras = (listview) findviewbyid(r.id.lvitems); lvobras.setadapter(adapter); lvobras.setonitemclicklistener(this); }
and custom dataapdapter listview:
public class obrasadapter extends arrayadapter<obra> { private context context; private arraylist<obra> datos; public obrasadapter(context context, arraylist<obra> datos) { super(context, r.layout.listview_item, datos); this.context = context; this.datos = datos; } @override public view getview(int position, view convertview, viewgroup parent) { view item = convertview; obrasholder holder; if (item == null) { item = layoutinflater.from(context).inflate(r.layout.listview_item, null); holder = new obrasholder(); holder.foto = (imageview) item.findviewbyid(r.id.imganimal); holder.num = (textview) item.findviewbyid(r.id.numc); holder.iden = (textview) item.findviewbyid(r.id.idenc); holder.ubi = (textview) item.findviewbyid(r.id.ubic); holder.hombres = (textview) item.findviewbyid(r.id.homc); holder.material = (textview) item.findviewbyid(r.id.matc); holder.eq1 = (textview) item.findviewbyid(r.id.eq1); holder.eq2 = (textview) item.findviewbyid(r.id.eq2); holder.eq3 = (textview) item.findviewbyid(r.id.eq3); holder.eq4 = (textview) item.findviewbyid(r.id.eq4); holder.fondo = (relativelayout) item.findviewbyid(r.id.fondobra); item.settag(holder); } holder = (obrasholder) item.gettag(); holder.foto.setimageresource(datos.get(position).getdrawableimageid()); if(datos.get(position).getprioridad()==1) { holder.num.settextcolor(color.red); holder.iden.settextcolor(color.red); holder.ubi.settextcolor(color.red); holder.hombres.settextcolor(color.red); holder.material.settextcolor(color.red); holder.eq1.settextcolor(color.red); holder.eq2.settextcolor(color.red); holder.eq3.settextcolor(color.red); holder.eq4.settextcolor(color.red); } if(datos.get(position).getprioridad()==2) { holder.num.settextcolor(color.parsecolor("#ff8000")); holder.iden.settextcolor(color.parsecolor("#ff8000")); holder.ubi.settextcolor(color.parsecolor("#ff8000")); holder.hombres.settextcolor(color.parsecolor("#ff8000")); holder.material.settextcolor(color.parsecolor("#ff8000")); holder.eq1.settextcolor(color.parsecolor("#ff8000")); holder.eq2.settextcolor(color.parsecolor("#ff8000")); holder.eq3.settextcolor(color.parsecolor("#ff8000")); holder.eq4.settextcolor(color.parsecolor("#ff8000")); } if(datos.get(position).getprioridad()==3) { holder.num.settextcolor(color.green); holder.iden.settextcolor(color.green); holder.ubi.settextcolor(color.green); holder.hombres.settextcolor(color.green); holder.material.settextcolor(color.green); holder.eq1.settextcolor(color.green); holder.eq2.settextcolor(color.green); holder.eq3.settextcolor(color.green); holder.eq4.settextcolor(color.green); } holder.num.settext(datos.get(position).getnum()); holder.iden.settext(datos.get(position).getiden()); holder.ubi.settext(datos.get(position).getub()); holder.hombres.settext(datos.get(position).gethom()); holder.material.settext(datos.get(position).getmat()); if(datos.get(position).getestado()==1) { holder.fondo.setbackgroundcolor(color.green); holder.num.settextcolor(color.white); holder.iden.settextcolor(color.white); holder.ubi.settextcolor(color.white); holder.hombres.settextcolor(color.white); holder.material.settextcolor(color.white); holder.eq1.settextcolor(color.white); holder.eq1.settextcolor(color.white); holder.eq1.settextcolor(color.white); holder.eq1.settextcolor(color.white); } if(! datos.get(position).equia.isempty()) { for(int i=0; i<datos.get(position).equia.size();i++) { if(i == 0) { holder.eq1.settext(string.valueof(datos.get(position).equia.get(i))); } if(i == 1) holder.eq2.settext(string.valueof(datos.get(position).equia.get(i))); if(i == 2) holder.eq3.settext(string.valueof(datos.get(position).equia.get(i))); if(i == 3) holder.eq4.settext(string.valueof(datos.get(position).equia.get(i))); } } else { holder.eq1.setvisibility(view.invisible); holder.eq2.setvisibility(view.invisible); holder.eq3.setvisibility(view.invisible); holder.eq4.setvisibility(view.invisible); } return item; }
}
can me? think must as:
@override protected void onstop() { unregisterreceiver(sendbroadcastreceiver); unregisterreceiver(deliverybroadcastreceiver); super.onstop(); }
Comments
Post a Comment