[Mono-bugs] [Bug 645257] New: ArrayAdapter<T>.Add(T item) Fails With Custom Types - Unable to Convert to Android.Runtime.IJavaObject
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun Oct 10 22:50:06 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=645257
https://bugzilla.novell.com/show_bug.cgi?id=645257#c0
Summary: ArrayAdapter<T>.Add(T item) Fails With Custom Types -
Unable to Convert to Android.Runtime.IJavaObject
Classification: Mono
Product: MonoDroid
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Runtime
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: pdbarnett at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: Beta-Customer
Blocker: Yes
Description of Problem:
When creating an ArrayAdapter using a custom type, attempts to add a new item
to the array fail. It appears that the runtime is trying to cast the object to
an Anroid.Runtime.IJavaObject object but the class does not implement this
interface. Attempting to implement this interface results in further problems
including NullReferenceExceptions.
Steps to reproduce the problem:
1. Define a custom class (e.g., "MyCustomItem")
2. Instantiate an ArrayAdapter<T> using the type (e.g.,
ArrayAdapter<MyCustomItem> adapter = new ArrayAdapter<MyCustomItem>(...);
3. Add instances of the custom type to the array (e.g., adapter.Add(new
MyCustomItem());
4. Run the code.
Actual Results:
Unhandled Exception: System.NotSupportedException: Do not know how to convert
value '(<type.ToString())' of type 'MyCustomItem' into an
Android.Runtime.IJavaObject instance.
Expected Results:
No exception.
How often does this happen?
Always
Additional Information:
The <type.ToString()> in the error message is actually just the output of
ToString() on the custom type
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list