Bug 8633 - ActionBarSherlock support library MapActivity
Summary: ActionBarSherlock support library MapActivity
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2012-11-28 10:59 UTC by Allie Miller
Modified: 2013-03-18 06:43 UTC (History)
2 users (show)

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

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 Allie Miller 2012-11-28 10:59:58 UTC
Case #19762

In a project using the sample ActionBarSherlock bindings library. It currently doesn't support MapActivity so the attempted workaround was to add SherlockMapActivity as in attachments, but it doesn't let me override OnCreateOptionsMenu and OnOptionsItemSelected.

Since MapActivity just inherits from an Activity, you should be able to just override those options. However, the problem occurs when overriding normal methods. It only works on >3.0 versions. When using methods like in ItsAliveActivity.cs, you override methods. 

In the sample below, if you press the "back" menu button on the MapActivity, it won't work on <3.0 version but till on > 3.0 devices - it working is it showing a ToastMessage. It is unclear if the use of the MapActivity is correct or not.

In the case, you can find a test project with the example

Also posted on the Xamarin forums. That post is attached to the case
Comment 2 Atsushi Eno 2013-03-18 06:43:36 UTC
The same principle to Java applies. To override methods that exist only after 3.0, you need to set targetSdkVersion after 3.0. And to differentiate code depending on targetSdkVersion (but above minSdkVersion), you'll need to write:

if (Android.OS.Build.VERSION.Sdk < Android.OS.Build.VERSION_CODES.Honeycomb) {
  // write code for <3.0