android-maps-v2

error with google maps v2 in tab (MapFragment in Fragment)

这一生的挚爱 提交于 2019-12-21 05:23:10
问题 I have a fragmentActivity where I build a tabHost and in each tab there is a Fragment. Well, I haver four tabs 3 with info and 1 with a fragment where is included a google-map-v2 (is a fragmentMAp in a Fragment because I want to add buttons etc.), when I select one tab and pass to other everything go well, but when I select the map tab, after that other tab and again the map tab an error is throw. My view seems like: |__||__|__|__| | __________ | || FRAGMENT || ||_____ _ || || FRAG| |_||| ||

getSupportFragmentManager() method is undefined for type MapFragment

依然范特西╮ 提交于 2019-12-21 02:49:12
问题 I'm trying to implement Google Map display and below are my codes: package com.fragments; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; public class MapFragment extends SherlockMapFragment { private GoogleMap mMap; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Check if marker is inside circle radius

牧云@^-^@ 提交于 2019-12-20 09:05:45
问题 I'm trying to know if a given marker is inside a circle radius. In javascript, i can do something like: google.maps.geometry.spherical.computeDistanceBetween(latLngCircleCenter, latLngPoint); But in android, using maps-v2, i'm stucked. 回答1: After a lot of research, i found a very simple solution: float[] distance = new float[2]; Location.distanceBetween( marker.getPosition().latitude, marker.getPosition().longitude, circle.getCenter().latitude, circle.getCenter().longitude, distance); if(

MapView not returning to normal state after clicking toggle switch

☆樱花仙子☆ 提交于 2019-12-20 04:05:14
问题 I'm trying to get my map view to return to the normal style when I flick the switch within my fragment to the the OFF position but it's not working. The following is what occurs during the process that I am facing: Fragment (containg map) and switch appeared Flicked switch to ON position Styled map appeared Flicked switch to OFF position Map doesn't change I tried using mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); but the map still remains stuck on the styled map view when I flick the

Check LatLngBounds.Builder if null

一笑奈何 提交于 2019-12-20 01:45:55
问题 This is mycode: LatLngBounds.Builder builder = new LatLngBounds.Builder(); for(int x = firstVisibleItem; x < lastVisibleItem; x++){ builder.include(temp.getPosition()); } However this line throws an error ( java.lang.IllegalStateException: no included points : double north = builder.build().northeast.latitude; This is because the above loop didn't run at all so no points were included in the builder . How can I check if the builder has at least one point? I tried builder.build()!=null which

Check LatLngBounds.Builder if null

孤者浪人 提交于 2019-12-20 01:45:01
问题 This is mycode: LatLngBounds.Builder builder = new LatLngBounds.Builder(); for(int x = firstVisibleItem; x < lastVisibleItem; x++){ builder.include(temp.getPosition()); } However this line throws an error ( java.lang.IllegalStateException: no included points : double north = builder.build().northeast.latitude; This is because the above loop didn't run at all so no points were included in the builder . How can I check if the builder has at least one point? I tried builder.build()!=null which

How to replace blue dot with my icon on google maps v2 in android?

半世苍凉 提交于 2019-12-19 08:55:37
问题 I am trying to replace blue dot (which shown current location on maps) with my own icon on Google maps v2. I have tried below, none worked. Android Maps API v2 Change MyLocation Icon Maps V2 myLocation blue dot callback Disable center button in MyLocation at Google Map API V2 Should look like this Below did not work Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.location_arrow1); googleMap.addMarker(new MarkerOptions().position(myPosition) .title(getIntent().getStringExtra

Back button very slow

馋奶兔 提交于 2019-12-19 04:12:14
问题 I have an android app with a TabActivity holding 4 tabs - a list view, a map view, another list and a webview. From the list view I can tap an item and it starts another activity, pressing back returns to the tab activity. However, once the map view tab has been visited, navigating to the second activity from the list view and then pressing the back button results in a hang of about 3-4 seconds. Once the map view has been visited, this problem never goes away until the app is exited. Some

android maps, markers and memory leaks

£可爱£侵袭症+ 提交于 2019-12-19 04:03:01
问题 I was reading the android docs http://developer.android.com/reference/com/google/android/gms/maps/MapFragment.html and I came across this sentence: Any objects obtained from the GoogleMap is associated with the view. It's important to not hold on to objects (e.g. Marker) beyond the view's life. Otherwise it will cause a memory leak as the view cannot be released. I don't fully understand that, and I'm not sure that it applies to me, but I just wanted to check: this only applies if the

Google Maps Android API v2 getVisibleRegion() returns 0

怎甘沉沦 提交于 2019-12-19 04:01:54
问题 I am using the new Google Maps Android API v2 and need to detect latlng coordinates for the corners of my screen view. I use mMap.getProjection().getVisibleRegion() to do this, which works fine the first time I load the program, but if I leave the program and then re-open it (either via the back button or the home button) getVisibleRegion() returns latlng coordinates that are all (0.0, 0.0). I have a workaround where I save the VisibleRegion object as a global in the application class when I