2nd Strigbuffer sends null

0

I am using a stringbuffer that works well for me but at the moment of making another stringbuffer for another operation it sends it to me null I would like to know what I am doing wrong and that it uses the same structure of which it already works.

private void showList(List<LineItem> list) {

    saleList = new ArrayList<Map<String, String>>();
    for(LineItem line : list) {
        saleList.add(line.toMap());
    }

    SimpleAdapter sAdap;
    sAdap = new SimpleAdapter(getActivity().getBaseContext(), saleList,
            R.layout.listview_lineitem, new String[]{"name","quantity","price","numProvider"},
            new int[] {R.id.name,R.id.quantity,R.id.price,R.id.numProvider});
    saleListView.setAdapter(sAdap);

    Iterator<LineItem> productosI = list.iterator();
    String[] arProd = new String[list.size()];
    String[] arProd1 = new String[list.size()];
    StringBuffer line = new StringBuffer();
    StringBuffer line2 = new StringBuffer();

    while (productosI.hasNext()) {
        for(int i =0; i<arProd.length;i++) {
            arProd[i] = productosI.next().ordernarArticulos();
        }

    }

    while (productosI.hasNext()) {
        for(int i =0; i<arProd1.length;i++) {
            arProd1[i] = productosI.next().ContenidoCompra();
        }
    }


    for(int x = 0; x<arProd.length;x++)
    {
        line = line.append(arProd[x]);
    }
    for(int y = 0; y<arProd1.length;y++)
    {
        line2 = line2.append(arProd1[y]);
    }

    for (LineItem e : list) {

        txtQR1 = e.ordenarEncabezado();
    }

    txtQR = txtQR1 + line+">";
    txtQR2 = ""+line2;
    Log.i("Contenido1",txtQR);

}

methods used above

public String ordenarEncabezado() {
    Date horaActual = new Date();
    String hora =(horaActual.getYear()+1900)+""+(horaActual.getMonth()+1)+""+horaActual.getDate();

    return "<<TTX"+"F"+getId()+"M01"+"P"+numProvider+"D"+ hora + ">";

}

public String ordernarArticulos(){


    return "<C"+product.getBarcode()+"Q"+quantity+">";

}

public String ContenidoCompra()
{
    return getProduct()+" "+quantity+"\n";
}
    
asked by MIke 04.09.2018 в 00:01
source

0 answers