On Sep 25, 2013, at 3:07 AM, venkatesh <[email protected]> wrote:
> I am binding filechooser library project to xamarin android .
>
> 1) filechooser.jar from eclipse build
> 2) Created a new Java Bindings Library project
> 3) Copied the generated filechooser.jar into the Jar directory and set the
> Build Action to "EmbeddedJar"
> 4) Copied the referenced android-support-v4.jar file from the
> android-sdk\extras folder to the Jar directory and set the Build Action to
> "EmbeddedReferenceJar"
> 5)Add the reference Mono.Android.Support.V4 to the binding project
There are lots of android-support-v4.jar's, and the android-support-v4.jar that
filechooser.jar probably differs from the one in the
Mono.Android.Support.V4.dll assembly.
You'll also be including _both_ android-support-v4.jar's into your final app,
which will likely confuse things. I would suggest removing
android-support-v4.jar from your binding project and just sticking with
Mono.Android.Support.V4.dll.
> 6) Attempted to build the project and got the errors .
>
>
> *Error 1 :* 'Com.Ipaulpro.Afilechooser.FileListFragment' does not implement
> interface member
> 'Android.Support.V4.App.LoaderManager.ILoaderCallbacks.OnLoadFinished(Android.Support.V4.Content.Loader,
> Java.Lang.Object)'
The "generated C# Code" you provide doesn't have any OnLoadFinished() member.
:-(
Is it there but not added in the email? Are there any warnings? Perhaps the
member is being skipped? Could you please provide diagnostic build output?
http://docs.xamarin.com/guides/android/deployment%2c_testing%2c_and_metrics/diagnostics
I do see FileListFragment.onLoadFinished() declared within api.xml, so it
_should_ be bound, though it's possible that the nested generics on the
parameter types are confusing things. If that's the case, you can fix that by
adding the following to Transforms\Metadata.xml:
<attr
path="/api/package[@name='com.ipaulpro.afilechooser']/class[@name='FileChooserFragment']/method[@name='onLoadFinished']/parameter[@name='p0']"
name="type"
>android.support.v4.content.Loader</attr>
<attr
path="/api/package[@name='com.ipaulpro.afilechooser']/class[@name='FileChooserFragment']/method[@name='onLoadFinished']/parameter[@name='p1']"
name="type"
>java.util.List </attr>
_However_, even once bound the parameter types won't match the expected
LoaderManager.ILoaderCallbacks.OnLoadFinished(Android.Support.V4.Content.Loader,
Java.Lang.Object) argument list. You will thus need to provide a partial class
declaration to implement this member:
// Add a new class to your solution:
namespace Com.Ipaulpro.Afilechooser {
partial class FileListFragment {
public void
OnLoadFinished(Android.Support.V4.Content.Loader loader, Java.Lang.Object value)
{
OnLoadFinished(loader, (Java.Util.List) value);
}
}
}
> *Error 2 :*
>
> 'Com.Ipaulpro.Afilechooser.FileLoader.LoadInBackground()': return type must
> be 'Java.Lang.Object' to match overridden member
> 'Android.Support.V4.Content.AsyncTaskLoader.LoadInBackground()'
Our binding infrastructure doesn't cleanly handle Java covariant return types,
and requires some help:
http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)#4.9.1.possible-causes
You'll need to edit Transforms\Metadata.xml and add something similar to the
following fragment:
<attr
path="/api/package[@name='com.ipaulpro.afilechooser']/class[@name='FileLoader']/method[@name='loadInBackground']"
name="managedReturn"
>Java.Lang.Object</attr>
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid