Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Java binding internal partial class issue ?

LukaszStachowiakLukaszStachowiak PLMember ✭✭
edited June 2015 in Xamarin.Android

Hi Guys,

I have to do a Java binding for a project I'm working on. The binding generated some code with errors. The partial class LoadingCompleteEventArgs is defined in two blocks of code and each of them has a p0 variable and P0 property.
I've been trying various rules in Metadata.xml but none of them worked. Does anyone of you guys knows how to resolve that issue?

Cheers,
Lukasz


using System;
using System.Collections.Generic;
using Android.Runtime;

namespace Com.Client.Sdk.Android.Core.Asset {

// Metadata.xml XPath class reference: path="/api/package[@name='com.client.sdk.android.core.asset']/class[@name='AssetController']"
[global::Android.Runtime.Register ("com/client/sdk/android/core/asset/AssetController", DoNotGenerateAcw=true)]

public partial class AssetController : global::Java.Lang.Object {

    public partial class LoadingCompleteEventArgs : global::System.EventArgs {

        public LoadingCompleteEventArgs (global::Com.Client.Sdk.Android.Core.Asset.Asset p0)
        {
            this.p0 = p0;
        }

        global::Com.Client.Sdk.Android.Core.Asset.Asset p0;
        public global::Com.Client.Sdk.Android.Core.Asset.Asset P0 {
            get { return p0; }
        }
    }

        public partial class LoadingCompleteEventArgs : global::System.EventArgs {

        public LoadingCompleteEventArgs (string p0, global::Android.Views.View p1, global::Android.Graphics.Bitmap p2)
        {
            this.p0 = p0;
            this.p1 = p1;
            this.p2 = p2;
        }

        string p0;
        public string P0 {
            get { return p0; }
        }

        global::Android.Views.View p1;
        public global::Android.Views.View P1 {
            get { return p1; }
        }

        global::Android.Graphics.Bitmap p2;
        public global::Android.Graphics.Bitmap P2 {
            get { return p2; }
        }
    }


    }

}

Answers

  • LukaszStachowiakLukaszStachowiak PLMember ✭✭

    If anybody is interested this is the fix for the above problem. The interface declaration was a few 100s lines above the errors what was a little confusing. Anyway the following rules solved the problem:

    <attr path="/api/package[@name='com.client.sdk.android.core.asset']/interface[@name='AssetController.DonkyImageLoadingListener']/method[@name='onLoadingComplete' and count(parameter)=3 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.view.View'] and parameter[3][@type='android.graphics.Bitmap']]" name="managedName">
        OnImageLoadingComplete
    </attr>
    
    <attr path="/api/package[@name='com.client.sdk.android.core.asset']/interface[@name='AssetController.DonkyImageLoadingListener']/method[@name='onLoadingFailed' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.view.View']]" name="managedName">
        OnImageLoadingFailed
    </attr>
    
    <attr path="/api/package[@name='com.client.sdk.android.core.asset']/interface[@name='AssetController.DonkyImageLoadingListener']/method[@name='onLoadingStarted' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.view.View']]" name="managedName">
        OnImageLoadingStarted
    </attr>
    
  • Chris_LamontChris_Lamont USUniversity ✭✭

    Thanks @LukaszStachowiak, that saved me!

Sign In or Register to comment.