refresh listview from thread

felipe1902felipe1902 BRMember ✭✭

Hi, i have a thread with barcode and when scan i need send the code to my listview and always refresh when recevei another barcode, but i don't know how to do, someone can help me?? Thanks

This is my thread:

if (barcode.Length > 0)
                                    {
                                        System.Diagnostics.Debug.WriteLine("Letto: " + barcode);
                                        //add  list to barcodes
                                        lstSelo.Add(barcode)
                   //send this list to my activity for refresh listview
                }

This is my activity:

 base.OnCreate(savedInstanceState);

        SetContentView(Resource.Layout.Cliente);

        ListView lstViewSelos = FindViewById<ListView>(Resource.Id.lstViewSelos);


        SelosAdapter seloAdapter = new SelosAdapter(this, //take list from thread but how??);
        lstViewSelos.Adapter = seloAdapter;

    //maybe this for refresh? but how ?
    seloAdapter.NotifyDataSetChanged();

And my axml:

<ListView
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/lstViewSelos" />

Thanks

Best Answer

Answers

  • felipe1902felipe1902 BRMember ✭✭

    I found a way to retrieve my list from thread but i don't know how to refresh my listview or activity, i guess need be inside thread?

  • felipe1902felipe1902 BRMember ✭✭

    Thank you

Sign In or Register to comment.