Bug 38117 - Picker renderer no working with FormsAppCompatActivity on Android
Summary: Picker renderer no working with FormsAppCompatActivity on Android
Status: RESOLVED DUPLICATE of bug 39847
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-01-28 03:06 UTC by Esteban Gimbernat
Modified: 2017-01-26 13:56 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

Sample Project (54.74 KB, application/x-zip-compressed)
2016-01-30 23:33 UTC, Esteban Gimbernat

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Esteban Gimbernat 2016-01-28 03:06:03 UTC
If I use FormsApplicationActivity over MainActivity the a Picker custom render work's fine, but if I change to the new FormsAppCompatActivity, the Renderer stops getting called, no one of their overriding methods.
Comment 1 Paul DiPietro [MSFT] 2016-01-28 18:01:19 UTC
A reproduction project would be appreciated in helping to investigate the issue.
Comment 2 Esteban Gimbernat 2016-01-30 23:33:07 UTC
Created attachment 14815 [details]
Sample Project
Comment 3 Esteban Gimbernat 2016-01-30 23:34:06 UTC
Hi Paul, sorry for being late. I have already attached the sample project.
Comment 4 Kelly Adams 2016-02-11 19:14:53 UTC
Your sample project is missing the [ExportRenderer] attribute to wire up your custom renderer to the Xamarin.Forms type, but even then it won't work because in FormsAppCompatActivity.LoadApplication it will wipe out your registration on Xamarin.Forms.Picker (unless you reflect into FormsAppCompatActivity and set the private renderersAdded field to true).
Comment 5 Michael Rumpler 2016-04-19 07:57:38 UTC
Esteban, you need to change the state of this ticket back to NEW or Xamarin will not look at it again.

But please add the [ExportRenderer] first as Kelly explained.
Xamarin has to provide a solution which is not as tightly coupled as their current FormsAppCompatActivity.LoadApplication. E.g. move that if(!renderersAdded) to a separate virtual method or use the DependencyService to get the correct renderer.

For a component developer it is currently impossible to provide renderers which work on both the standard Android or AppCompat. E.g.: I wrote MR.Gestures.Button with a custom renderer which inherits from Xamarin.Android.Platform.Android.ButtonRenderer. But when my users use AppCompat, then it should actually inherit from Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer.
Comment 6 adrianknight89 2016-10-13 16:59:56 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/452
Comment 7 E.Z. Hart [MSFT] 2017-01-26 00:19:01 UTC
This is a duplicate of https://bugzilla.xamarin.com/show_bug.cgi?id=39847 and was fixed in version 2.3.0 (PR https://github.com/xamarin/Xamarin.Forms/pull/112).

*** This bug has been marked as a duplicate of bug 39847 ***