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

Unable to convert instance of type 'Android.Widget.Button' to type 'android/widget/ListView'

$
0
0

Hello all!

I know what you're thinking. I shouldn't be converting a Button to a ListView. But I'm not! Honest! The offending line of code is:

ListView lv = FindViewById(Resource.Id.CollectionList);

CollectionList is, in fact, a ListView. It's ID listed in Resource.designer.cs is unique and not mixed up with some Button. This is code that has been working just fine for months. This morning I switched to the beta channel to see if it fixed a problem with an Android 4.0 device I acquired to test with. It didn't fix it, so I switched back to stable and the emulator. Now I get this exception.

I switched back to beta, and that won't even build or clean. So back to Stable. I've cleaned, rebuilt, and restarted all to no avail. This is in my main activity, so there's no getting around it.

Help? I'm now dead in the water with an ominous looming deadline.

Thanks in advance! -Karen

P.S. Oh yeah, here's my "About" dump: (Yes, I'm doing Android on a Mac. Iphone is next.)

=== Xamarin Studio ===

Version 4.0.12 (build 3)
Installation UUID: 4f322a6d-cc69-4c01-a5ea-ad260227e421
Runtime:
    Mono 3.2.0 ((no/7c7fcc7)
    GTK 2.24.20
    GTK# (2.12.0.0)
    Package version: 302000000

=== Apple Developer Tools ===

Not Found

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.Android ===

Version: 4.8.0 (Indie Edition)
Android SDK: /Users/karenc/Library/Developer/Xamarin/android-sdk-mac_x86
    Supported Android versions:
        2.1   (API level 7)
        2.2   (API level 8)
        2.3   (API level 10)
        3.1   (API level 12)
        3.2   (API level 13)
        4.0   (API level 14)
        4.0.3 (API level 15)
        4.1   (API level 16)
        4.2   (API level 17)
Java SDK: /usr
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

=== Xamarin.iOS ===

Version: 6.4.1.1 (Starter Edition)
Hash: 5a0fe54
Branch: 
Build date: 2013-30-07 08:24:03-0400

=== Build Information ===

Release ID: 400120003
Git revision: 593d7acb1cb78ceeeb482d5133cf1fe514467e39
Build date: 2013-08-07 20:30:53+0000
Xamarin addins: 25a0858b281923e666b09259ad4746b774e0a873

=== Operating System ===

Mac OS X 10.8.4
Darwin Karens-Mac-mini.local 12.4.0 Darwin Kernel Version 12.4.0
    Wed May  1 17:57:12 PDT 2013
    root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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