Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old January 27th, 2013, 07:24 AM   #1 (permalink)
Member
Thread Author (OP)
 
Join Date: Dec 2010
Location: Aarhus, Denmark
Posts: 136
 
Device(s): SE Xperia X10
Carrier: Not Provided

Thanks: 2
Thanked 22 Times in 22 Posts
Default GoogleMap resets and stops responding!?

Hi all..

I am not sure this is the right sub-forum to post in, but here goes.

I am working on an app that uses a GoogleMap and lots of overlays/markers. Controls and navigation is handled automatically (no direct user interaction with the map needed so far).

Things work the way I want right until the app pauses and goes into the background. When I resume the app the map has zoomed out to 0:0 and it doesn't react to animateMap or anything anymore. I can't seem to figure how I get it back to the state where it doesn't react to user interaction and actually updates with my markers and stuff..

Below are the three methods handling the map, and it doesn't seem to react on any of it after a resume. Any hints?

Code:
private void setupMap(){
		getSupportFragmentManager().beginTransaction().replace(R.id.trackeractivity_map, new SupportMapFragment()).commit();
		FragmentManager fragmentManager = getSupportFragmentManager();
		SupportMapFragment supportMapFragment = (SupportMapFragment) fragmentManager.findFragmentById(R.id.trackeractivity_map);
		mMap = supportMapFragment.getMap();
		mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
		mMap.setMyLocationEnabled(true);
		
		Log.d(TAG, "Max zoom level " + mMap.getMaxZoomLevel());
	}
	
private void updateUserLocation(double lat, double lon){
		Log.d(TAG, "updateUserLocation - " + lat + " : " + lon);
		mLastLocationLat = lat;
		mLastLocationLon = lon;
		CameraPosition userPos = new CameraPosition(new LatLng(lat, lon), mMap.getMaxZoomLevel()-4, 0, 0);
		mMap.animateCamera(CameraUpdateFactory.newCameraPosition(userPos));
	}
	
private void updateMapOverlay(double lat, double lon){
		Log.d(TAG, "updateMapOverlay - " + lat + " : " + lon + " - Type " + mCurrentType);
		MarkerOptions marker = new MarkerOptions();
		marker.position(new LatLng(lat, lon));
		marker.draggable(false);
		marker.icon(BitmapDescriptorFactory.fromResource(getTypeDrawableID(mCurrentType)));
		mMap.addMarker(marker);
	}

Advertisements
JamTheMan is offline  
Reply With Quote
sponsored links
Old January 31st, 2013, 05:45 AM   #2 (permalink)
Member
Thread Author (OP)
 
Join Date: Dec 2010
Location: Aarhus, Denmark
Posts: 136
 
Device(s): SE Xperia X10
Carrier: Not Provided

Thanks: 2
Thanked 22 Times in 22 Posts
Default

No one?
JamTheMan is offline  
Reply With Quote
Reply
Tags
googlemap


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:18 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.