protected void LoadProduct(ProductDetails[] productlist) { try { LayoutInflater inflater = (LayoutInflater)v.Context.GetSystemService(Context.LayoutInflaterService); TableLayout tblEvents = v.FindViewById<TableLayout>(Resource.Id.tblproducts); tblEvents.RemoveAllViews(); tblEvents.Invalidate(); tblEvents.RefreshDrawableState(); foreach (ProductDetails events in productlist) {
using( View item = inflater.Inflate(Resource.Layout.searchproductrowtemplate, tblEvents, false)){ TextView lblProductTitle = (TextView)item.FindViewById(Resource.Id.lblProductTitle); TextView lblCategoryTilte = (TextView)item.FindViewById(Resource.Id.lblCategoryTilte); TextView lblSupplierTilte = (TextView)item.FindViewById(Resource.Id.lblSupplierTilte); TextView lblSubstanceTilte = (TextView)item.FindViewById(Resource.Id.lblSubstanceTilte); lblProductTitle.Text = events.Product; lblCategoryTilte.Text = events.Category; lblSupplierTilte.Text = events.SupplierName; lblSubstanceTilte.Text = events.Substance; Button btnProductSelect = (Button)item.FindViewById(Resource.Id.btnProductSelect); btnProductSelect.Tag = events.PKProductID; // btnProductSelect.Click += delegate(object sender, EventArgs e) // { // Button btnProductSelect1 = (Button)sender; // HandleRowSelectedEvent( btnProductSelect1.Tag.ToString()); // // }; tblEvents.AddView(item); } } } catch (Exception ex) { ErrorHandling.ErrorEntry(ex.Message, "Home.cs-LoadEvent"); } i am trying to bind a tablelayout with row template.after adding couple of row to the table.outstanding GREFs out is keep on increasing . can any please guide me to solve this problem. check below stack at Android.Runtime.JNIEnv.NewGlobalRef (intptr) [0x00000] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:378 at Java.Lang.Object.RegisterInstance (Android.Runtime.IJavaObject,intptr,Android.Runtime.JniHandleOwnership) [0x00041] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:139 at Java.Lang.Object.SetHandle (intptr,Android.Runtime.JniHandleOwnership) [0x00000] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:123 at Java.Lang.Object..ctor (intptr,Android.Runtime.JniHandleOwnership) [0x00023] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:52 at Android.Views.View..ctor (intptr,Android.Runtime.JniHandleOwnership) <IL 0x00003, 0x00057> at Android.Widget.TextView..ctor (intptr,Android.Runtime.JniHandleOwnership) <IL 0x00003, 0x00057> at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___intptr_int (object,intptr,intptr,intptr) <IL 0x0005e, 0xffffffff> at System.Reflection.MonoCMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x0010f, 0x006e7> at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x00007, 0x0009b> at System.Reflection.ConstructorInfo.Invoke (object[]) <IL 0x00017, 0x000db> at Java.Interop.TypeManager.CreateProxy (System.Type,intptr,Android.Runtime.JniHandleOwnership) [0x00053] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:253 at Java.Interop.TypeManager.CreateInstance (intptr,Android.Runtime.JniHandleOwnership,System.Type) [0x001cc] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:234 at Java.Lang.Object.GetObject (intptr,Android.Runtime.JniHandleOwnership,System.Type) [0x000b4] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:227 at Java.Lang.Object._GetObject<T> (intptr,Android.Runtime.JniHandleOwnership) [0x0001a] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:207 at Java.Lang.Object.GetObject<T> (intptr,Android.Runtime.JniHandleOwnership) [0x00000] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:199 at Android.Views.View.FindViewById (int) [0x0002d] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.View.cs:5883 at ACropManager.SearchProductDialog.LoadProduct (CropManager.ProductDetails[]) [0x00089] in c:\Users\VSS31\Documents\Visual Studio 2010\Projects\ACropManager\ACropManager\Fragments\SearchProductDialog.cs:206 at ACropManager.SearchProductDialog.BindProducts (CropManager.ProductDetails[]) [0x00009] in c:\Users\VSS31\Documents\Visual Studio 2010\Projects\ACropManager\ACropManager\Fragments\SearchProductDialog.cs:265 at ACropManager.SearchProductDialog.searchResult () [0x00063] in c:\Users\VSS31\Documents\Visual Studio 2010\Projects\ACropManager\ACropManager\Fragments\SearchProductDialog.cs:178 at ACropManager.SearchProductDialog.OnCreateView (Android.Views.LayoutInflater,Android.Views.ViewGroup,Android.OS.Bundle) [0x00198] in c:\Users\VSS31\Documents\Visual Studio 2010\Projects\ACropManager\ACropManager\Fragments\SearchProductDialog.cs:81 at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (intptr,intptr,intptr,intptr,intptr) [0x00021] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid-bindings/Compatibility-v4/bindings/obj/platform-8/src/generated/Android.Support.V4.App.Fragment.cs:953 at (wrapper dynamic-method) object.9859465b-8f68-4b0d-ae42-492a38aaf8e1 (intptr,intptr,intptr,intptr,intptr) <IL 0x00023, 0x00063> at (wrapper native-to-managed) object.9859465b-8f68-4b0d-ae42-492a38aaf8e1 (intptr,intptr,intptr,intptr,intptr) <IL 0x00024, 0xffffffff>Thread started: -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Mono-UnhandledException-in-emulator-tp5111558p5713180.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid