He stores everything but only shows me the last

0

I have a problem and I have not been able to solve it, obviously I am wrong but I have not been able to notice my error, the thing is that I want to print a header and a content which contains Barcode and Quantity, to a QR moment to put the result in an array you see that if you store them but when calling the variable in which you store the content in String, you only send me the last one. someone who can help me, I would greatly appreciate it. PS I'm not very good at Android Studio I do what I can haha.

    public 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,
            listview_lineitem, new String[]{"name", "quantity", "price", "numProvider"},
            new int[]{R.id.name, R.id.quantity, R.id.price, numProvider});
    saleListView.setAdapter(sAdap);


    Iterator<LineItem> productosI = list.iterator();

    String[] arProd = new String[list.size()];

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

    }
    for(String eProd : arProd)
    {
        txtQR1 = eProd;
        Log.i("Contenido",txtQR1);
    }


    for (LineItem e : list) {

        txtQR2 = e.ordenarEncabezado() ;

    }

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

    }


    public void showPopup(View anchorView) {
    Bundle bundle = new Bundle();
    bundle.putString("edttext", totalPrice.getText().toString());
    bundle.putString("arraylist",txtQR);
    PaymentFragmentDialog newFragment = new PaymentFragmentDialog(SaleFragment.this, reportFragment);
    newFragment.setArguments(bundle);
    newFragment.show(getFragmentManager(), "");
}

This is another class where you create the methods

    public String ordenarEncabezado() {
    Date horaActual = new Date();
    String hora =(horaActual.getYear()+1900)+""+(horaActual.getMonth()+1)+""+horaActual.getDate();
    //for(int i=0;i<)



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

}

public String ordernarArticulos(){


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




}
    
asked by MIke 12.01.2018 в 22:01
source

0 answers