i not understand how perform operation mention. when press button want change amount of food orders want update button on selected topic or, if not, activate entire list
public class adapterfood extends arrayadapter<charola.producto> { imageview imgfood; private string nameservice = "agregaritemcharola"; private string usuarioid = "usuarioid"; private string productoid = "productoid"; private string cantidad = "cantidad"; private string especificaciones = "especificaciones"; private string urlcomplete = constantes.urlmain + nameservice + "?"; private fragment fragment; private list<charola.producto> productolist; public adapterfood(context context, list<charola.producto> productolist, fragment fragment) { super(context, 0, productolist); this.fragment = fragment; this.productolist = productolist; } @override public view getview(final int position, view convertview, viewgroup viewgroup) { layoutinflater inflater = (layoutinflater) getcontext().getsystemservice(context.layout_inflater_service); view listviewinflate = convertview; if (convertview == null) { listviewinflate = inflater.inflate(r.layout.item_menu, viewgroup, false); } imgfood = (imageview) listviewinflate.findviewbyid(r.id.imagefood); textview titulofood = (textview) listviewinflate.findviewbyid(r.id.tittlefood); textview descricionfood = (textview) listviewinflate.findviewbyid(r.id.descriptionfood); textview precio = (textview) listviewinflate.findviewbyid(r.id.pricefood); final button btnanadir = (button) listviewinflate.findviewbyid(r.id.buttonanadir); final charola.producto producto = getitem(position); titulofood.settext(producto.getnombre().tostring()); descricionfood.settext(producto.getdescripcion()); precio.settext("$" + producto.getprecio() + ".00"); if (producto.getcantidad() != 0) { btnanadir.settext("+ añadir (" + producto.getcantidad() + ")"); btnanadir.setbackgroundresource(r.drawable.btns_dialogs); } else { btnanadir.settext("+ añadir"); btnanadir.setbackgroundresource(r.drawable.btn_anadir); } btnanadir.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { new consumeserviceagregarproductoacharola().execute(urlcomplete + "#" + producto.getidproducto()); } }); glide.with(getcontext()). load(producto.geturlfoto()).placeholder(r.drawable.place_holder) .into(imgfood); return listviewinflate; } //recuperar id usuario public int recuperaridusario() { sharedpreferences sharedpreferences = getcontext().getsharedpreferences("mis_prefrencias", context.mode_private); int valor = sharedpreferences.getint("id", 1); return valor; } //asynta }
Comments
Post a Comment