B
B
bodusiacool2019-05-30 21:10:28
Java
bodusiacool, 2019-05-30 21:10:28

I use data transfer via bundle, but for some reason the data is transferred only 1 time, how to fix it?

I am using this piece of code to send data

@Override
    public void onClick(View v) {
        DialogFragment dlg;
        dlg = new barcodeView();
        Coupons coupons = coupons2.get(position);
        String i = coupons.getTAG();

        Log.v("dwdwdw",""+i);
        Bundle bundle = new Bundle();
        if (i.equals("lentaAmount500")){

            FragmentManager fragmentManager = ((AppCompatActivity)context).getSupportFragmentManager();
            bundle.clear();
            bundle.putString("someValue", "5000112592702");

            dlg.setArguments(bundle);
            dlg.show(fragmentManager,"barcodeview");
        }
        if (i.equals("lentaAmount300")){

            FragmentManager fragmentManager = ((AppCompatActivity)context).getSupportFragmentManager();
            bundle.clear();
            bundle.putString("someValue", "0000054490086");
            dlg.setArguments(bundle);
            dlg.show(fragmentManager,"barcodeview");
        }
        if (i.equals("lentaAmount100")){
            FragmentManager fragmentManager = ((AppCompatActivity)context).getSupportFragmentManager();
            bundle.clear();
            bundle.putString("someValue", "0000054491472");
            dlg.setArguments(bundle);
            dlg.show(fragmentManager,"barcodeview");
        }
        if (i.equals("petiarochkaAmount500")){

            FragmentManager fragmentManager = ((AppCompatActivity)context).getSupportFragmentManager();
            bundle.clear();
            bundle.putString("someValue", "0000054492387");
            dlg.setArguments(bundle);
            dlg.show(fragmentManager,"barcodeview");
        }
        if (i.equals("petiarochkaAmount300")){

            FragmentManager fragmentManager = ((AppCompatActivity)context).getSupportFragmentManager();
            bundle.clear();
            bundle.putString("someValue", "0049000065206");
            dlg.setArguments(bundle);
            dlg.show(fragmentManager,"barcodeview");
        }
        if (i.equals("petiarochkaAmount100")){

            FragmentManager fragmentManager = ((AppCompatActivity)context).getSupportFragmentManager();
            bundle.clear();
            bundle.putString("someValue", "050051000481");
            dlg.setArguments(bundle);
            dlg.show(fragmentManager,"barcodeview");
        }

And this is for receiving But why is everything fine the first time, the data is sent, but with the next click it displays the old data, that is, the data being sent does not change. How to clean them?
barcode_data = bundle.getString("someValue");

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question