Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
PagerAdapter source missing virtual keyword.
public string GetPageTitle(int position);
[Register("getPageTitle", "(I)Ljava/lang/CharSequence;", "GetGetPageTitle_IHandler")]
prevents me from overriding the method
I tried to reproduce this issue but not able to reproduce this. Could you please share steps or a sample application to reproduce this issue, that would be very helpful to reproduce this issue at our end.
=== Xamarin Studio ===
Version 5.9.4 (build 5)
Installation UUID: 08cac54d-8d5b-406e-adf0-707e52f76272
Microsoft .NET 4.0.30319.18408
GTK+ 2.24.22 (MS-Windows theme)
=== Xamarin.Android ===
Version: 5.1.4 (Business Edition)
Android SDK: E:\android-sdk
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode)
=== Xamarin Android Player ===
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe
=== Build Information ===
Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 17:16:25-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8
=== Operating System ===
Windows 6.2.9200.0 (64-bit)
I can reproduce this bug. The bug is in Android Support Library v4 (http://components.xamarin.com/view/xamandroidsupportv4-18/ ), not in the base Android SDK.
The method that should marked virtual is PagerAdapter.getPageTitle (https://developer.android.com/reference/android/support/v4/view/PagerAdapter.html#getPageTitle(int) ) , because it's used to add titles to TabLayout (see the documentation of TabLayout.setTabsFromPager: https://developer.android.com/reference/android/support/design/widget/TabLayout.html#setTabsFromPagerAdapter(android.support.v4.view.PagerAdapter) )
As a workaround until this gets fixed, you can override GetPageTitleFormatted. This is how it's done in the Xamarin Cheesesquare demo app (https://github.com/xamarin/monodroid-samples/blob/master/android5.0/Cheesesquare/MainActivity.cs#L115 ):
>public override Java.Lang.ICharSequence GetPageTitleFormatted (int position)
> return new Java.Lang.String (fragmentTitles [position]);
It is not only the workaround but is the actual solution; the Java method that needs to be overriden is the one that takes CharSequence (otherwise there would be big confusion between the utility overload that takes string and the actual body of the actual interoperating Java method).