Пример #1
0
        public static JniType GetCachedJniType(ref JniType cachedType, string classname)
        {
            if (cachedType != null && cachedType.PeerReference.IsValid)
            {
                return(cachedType);
            }
            var t = new JniType(classname);

            if (Interlocked.CompareExchange(ref cachedType, t, null) != null)
            {
                t.Dispose();
            }
            cachedType.RegisterWithRuntime();
            return(cachedType);
        }
            JniInstanceMethods(Type declaringType)
            {
                var jvm  = JniEnvironment.Runtime;
                var info = jvm.TypeManager.GetTypeSignature(declaringType);

                if (info.SimpleReference == null)
                {
                    throw new NotSupportedException(
                              string.Format("Cannot create instance of type '{0}': no Java peer type found.",
                                            declaringType.FullName));
                }

                DeclaringType = declaringType;
                jniPeerType   = new JniType(info.Name);
                jniPeerType.RegisterWithRuntime();
            }