Bug 7581 - MapFragment Cursor error in Framework
Summary: MapFragment Cursor error in Framework
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-01 22:03 UTC by Ian
Modified: 2013-05-24 10:35 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED NOT_ON_ROADMAP

Description Ian 2012-10-01 22:03:50 UTC
We have a Map contained in a MapFragment

However when the map loads, we get this error from the runtime:

Loaded assembly: /data/data/SteamTrap/files/.__override__/SteamTrap.dll       
Loaded assembly: Mono.Android.dll [External] 
Loaded assembly: System.Core.dll [External] 
Loaded assembly: MonoDroidConstructors [External] 
Loaded assembly: Mono.Android.GoogleMaps.dll [External]

Cursor finalized without prior close()

The map then does not load (the view is all squares with the google logo)

The same map hydrated in a simple MapActivity does work though so the XML is good.

Is this a MonoDroid error?
Comment 1 Ian 2012-10-01 22:06:03 UTC
Here's my MapFragment

public class MapFragment : Fragment
	{
		// FOLLOW http://stackoverflow.com/questions/5109336/mapview-in-a-fragment-honeycomb
		public override void OnCreate(Bundle savedInstanceState)
		{
			base.OnCreate(savedInstanceState);

			Bundle state = null;
			mLocalActivityManager = new LocalActivityManager(Activity, true);
			mLocalActivityManager.DispatchCreate(state);
		}

		public override Android.Views.View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			//This is where you specify you activity class
			Intent i = new Intent(Activity, typeof(SteamLocationMapActivity)); 
			Window w = mLocalActivityManager.StartActivity("tag", i); 
			View currentView=w.DecorView; 
			currentView.Visibility = ViewStates.Visible; 
			currentView.FocusableInTouchMode = true; 
			((ViewGroup) currentView).DescendantFocusability = DescendantFocusability.AfterDescendants;
			return currentView;
		}

		private LocalActivityManager mLocalActivityManager;
		protected LocalActivityManager GetLocalActivityManager() {
			return mLocalActivityManager;
		}	
	
	}
Comment 2 Ian 2012-10-01 22:07:08 UTC
When I just set the SteamLocationMapActivity to be the MainLauncher it works fine.

It's hosted in a MapFragment that is the issue. All I see are the squares of a the map and the Google logo.
Comment 3 Tom Opgenorth 2013-05-24 10:35:16 UTC
This looks like a Google Maps for Android v1 issue, which has been deprecated as of March, 2013. 

Google Maps Android API v2 introduced the MapFragment and the SupportMapFragment which means that it's no longer necessary to create a Fragment subclass for displaying a map. See the Maps & Location v2 sample at https://github.com/xamarin/monodroid-samples/tree/master/MapsAndLocationDemo_v2.