Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Unhandled Error in Android.Platform.GetRenderer

$
0
0

I am now experiencing an issue that I believe started with XF 1.4. It occurs in a custom renderer on Android. My custom ViewCellRenders were working prior to upgrading to 1.4.0. 1.4.1-pre does not fix the issue.

After executing the following code in my Renderer, I get the error with the attached call stack (sorry, couldn't figure out how to copy the call stack, so a screen shot will have to do...).

I have a functionally equivalent Renderer in iOS working fine, so I suspect the issue is not in my common Forms project.

Let me know what else you need from me to diagnose this...

public class xEDRModelCellRenderer : ViewCellRenderer
{
public xEDRModelCellRenderer( ) { }

                protected override Android.Views.View GetCellCore( Cell item, Android.Views.View convertView, ViewGroup parent, Context context )
                {
                    var x = (xEDRModelCell)item;
                    return BuildView( convertView,
                                        context,
                                        x.Item as eDRModel.ModelBase );

                }
                protected Android.Views.View BuildView( Android.Views.View convertView,
                                                      Context context,
                                                      eDRModel.ModelBase item )
                {
                    var view = convertView;
                    if ( view == null )
                    {
                        view = ( context as Activity ).LayoutInflater.Inflate( Resource.Layout.GenericTextListItemLayout, null );
                    }
                    else { }

                    var lblName = view.FindViewById( Resource.Id.lblName ) as TextView;

                    lblName.TextSize = (float)eDR.XF.App.m_ui.DefaultFontSizeL;

                    if ( item.uiSelected )
                    {
                        view.SetBackgroundColor( App.m_ui.SecondaryBackgroundColor.ToAndroid() );
                        lblName.SetTextColor( App.m_ui.SecondaryForegroundColor.ToAndroid() );
                    }
                    else
                    {
                        view.SetBackgroundColor( App.m_ui.PrimaryBackgroundColor.ToAndroid() );
                        lblName.SetTextColor( App.m_ui.PrimaryForegroundColor.ToAndroid() );
                    }

                    //Assign this item's values to the various subviews
                    lblName.SetText( item.ToString(), TextView.BufferType.Normal );

                    return view;
                }
            }

Thanks
-Bill


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>