Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

app crash when populating listview

$
0
0

hello i have a simple app that has 2 button(one for turning on the BT and one for starting to show BT paired devices) and a listview(these 3 are in a horizontal layout).and i have another layout named ListItemLayout which has only a textview in it. i have an array adapter: public ArrayAdapter<String> mylist=new ArrayAdapter<string> (this,Resource.Layout.ListItemLayou); (don't mind the missing 't' it was a misstype)

and here is my code for populating my listview:

void scanshow (object sender, EventArgs e)
        {

            BluetoothAdapter Btadapt= BluetoothAdapter.DefaultAdapter;
            System.Collections.Generic.ICollection<BluetoothDevice> pdev = Btadapt.BondedDevices;
            foreach (var item in pdev) {
                mylist.Add (item.Name);
            }
            dev_list.Adapter = mylist;
        }

but whenever i click my show button my app crash and this is the output:

[AndroidRuntime] Caused by: java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>