December 16, 2017

Bug : Java.Lang.NullPointerException,Attempt to invoke virtual method 'boolean' on a null object reference

I have observed this above mentioned bug keeps on hitting when using Xamarin form,UI control "Frame" for android while it executes without any issues for iOS. 

In my previous post discussed about Frame border highlight issues in android. Frame control still has one or other problem with android and still remains a question mark why Xamarin team has not given any fix for this android specific problem.

Fix: Observed this problem when android custom renderer for Frame gets inherited from the base class Xamarin.Forms.Platform.Android.FrameRenderer" instead of that converting base class to "Visual Element" of type "Frame" (as follows) resolved this issue.

Root Cause analysis is still empty from my side :), if you have any idea please do update.
//Droid project,custom renderer for Frame
[assembly: ExportRenderer(typeof(Frame), typeof(FrameHighLightRenderer))]
namespace Inspect.Droid.Renderers
    class FrameHighLightRenderer : VisualElementRenderer
        protected override void OnElementChanged(ElementChangedEventArgs e)
           //element changed code goes here

For more updates please do like our FB page, Happy coding :).

1 comment: