google-maps-android-api-2

Custom infowindow in Google map android v2

青春壹個敷衍的年華 提交于 2019-11-27 20:10:50
问题 I am using Google Map API V2 and i have created a custom InfoWindow for a Marker on map.In this InfoWindow i have a button. My problem is unable to set Onclicklistener/functioning to that Button(Dummy).Any one give me some idea to solve this : Here is code snippet: public class MarkerView extends FragmentActivity implements OnMarkerClickListener,OnInfoWindowClickListener{ private GoogleMap mMap; private Marker chennai; private View infoWindow; @Override protected void onCreate(Bundle arg0) {

How can i take/merge screen shot of Google map v2 and layout of xml both programmatically?

假装没事ソ 提交于 2019-11-27 19:55:31
I am taking screenshot of Google Map v2 by using code of this answer which is giving me output : Which is fine to take screen shot of Map With following code i can take the screen shot of Layout with black map screen thats ok as with following code Map will black in ScreenShot String mPath = Environment.getExternalStorageDirectory().toString() + "/" + "myTestScr" + System.currentTimeMillis() + ".jpeg"; Bitmap bitmap; View v1 = (View) findViewById(R.id.rootviewtest); v1.setDrawingCacheEnabled(true); bitmap = Bitmap.createBitmap(v1.getDrawingCache()); v1.setDrawingCacheEnabled(false);

GooglePlayServicesUtil.getErrorDialog is null

依然范特西╮ 提交于 2019-11-27 19:37:51
I'm using ACRA ( arca.ch ) to generate automatic error reports. I just released a new version of my app using Google Maps Android API v2. I'm getting an error reported by EEEPad and Transformer Pad users when trying to show the dialog returned by GooglePlayServicesUtil.getErrorDialog. Does anyone know why this might happen? Here is the relevant code and Logcat as reported by acra: While calling this line: int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(resultCode != ConnectionResult.SUCCESS) { //The dialog that comes back is null (probably due to the logcat

Android Google Maps get Boundary Co-ordinates

霸气de小男生 提交于 2019-11-27 19:25:44
I am using Google Maps v2 in my application. When the user pans or zooms on the screen I would like to get the area of the map based on which I want to fetch the POI only in the screen view part. I went through the documentation but could not find any help. Pavel Dudka You need to use Projection and VisibleRegion classes in order to get visible LatLng region. So your code would look something like: LatLngBounds curScreen = googleMap.getProjection() .getVisibleRegion().latLngBounds; 来源: https://stackoverflow.com/questions/14700498/android-google-maps-get-boundary-co-ordinates

Android Google Maps v2 - set zoom level for myLocation

百般思念 提交于 2019-11-27 19:12:32
Is it possible to change the zoom level for myLocation with the new Google Maps API v2? If you set GoogleMap.setEnableMyLocation(true); you get a button on the map to find your location. If you click on it, the map will bring you to your location and zoom it in to some level. Can I change this zoom to be less or more? DiscDev It's doubtful you can change it on click with the default myLocation Marker. However, if you would like the app to automatically zoom in on your location once it is found, I would check out my answer to this question Note that the answer I provided does not zoom in, but

Should I use MapView or MapFragment

痞子三分冷 提交于 2019-11-27 18:19:38
I am not sure whether I should be using MapView or stick to using a MapFragment . My application is an app that finds the nearest set of places that are closest to you. I want to be able to add locations, display details of a marker when I press a marker and when the user moves along the map I want to be able to get the coordinates of the center of the map and display the nearest locations within a defined radius. Would I be at a disadvantage if I continue to use MapFragments or should I switch over to MapView while I still have the chance? Emil Adz First of all, soon the MapView and Google

Error inflating class fragment: Duplicate id , tag null, or parent id with another fragment

三世轮回 提交于 2019-11-27 18:16:00
问题 I am trying to make an app in which when user clicks on item in ListView, the GoogleMaps is displayed. I have tried following code: ShowPlacesActivity.java public class ShowPlaceActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_place); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container_showplaces, new PlaceholderFragment()) .commit(); }

Custom marker in google maps in android with vector asset icon

有些话、适合烂在心里 提交于 2019-11-27 17:58:19
How can we achieve a map marker icon with vector asset file, the way google shows it like this, programatically: Update: map.addMarker(new MarkerOptions() .position(latLng) .icon(BitmapDescriptorFactory.fromResource(R.drawable.your_vector_asset)) .title(title); this doesnot work when dealing with vector assets. The main reason to ask the question. The error with the above code: java.lang.IllegalArgumentException: Failed to decode image. The provided image must be a Bitmap. I was looking for exact same requirement, and seeing this question made me happy at first, but same as @Shuddh I wasn't

Check if a latitude and longitude is within a circle

北慕城南 提交于 2019-11-27 17:54:15
See this illustration: What I would like to know is: How to create an area (circle) when given a latitude and longitude and the distance (10 kilometers) How to check (calculate) if a latitude and longitude is either inside or outside the area I would prefer if you can give me code example in Java or specifically for Android with Google Maps API V2 flx What you basically need, is the distance between two points on the map: float[] results = new float[1]; Location.distanceBetween(centerLatitude, centerLongitude, testLatitude, testLongitude, results); float distanceInMeters = results[0]; boolean

How to convert a LatLng and a radius to a LatLngBounds in Android Google Maps API v2?

和自甴很熟 提交于 2019-11-27 17:41:56
I believe this is a limitation of the recent Google Maps API v2. They have recently added the ability to draw a Circle on the ground - but if you want to position the camera such that it shows the entire Circle, there exists no way to do so. One can call CameraUpdateFactory#newLatLngBounds(bounds, padding) where "bounds" is a LatLngBounds and "padding" is a distance in pixels. The issue is that there is no way to create a LatLng and a radius into a LatLngBounds. The constructor for LatLngBounds only takes 2 LatLng instances and generates a rectangle where these are the NW and SE corners.