android-maps

Google Maps with too many marks

回眸只為那壹抹淺笑 提交于 2019-12-05 09:16:42
问题 I am using the Android's WebView component to display Google Maps with POIs. For displaying the POI I am using the JavaScript API class google.maps.Marker. The problem is that when all 350 POIs are shown on the map they makes the WebView slow and almost unusable... How to optimize it??? Is there any API that e.g. puts together the map zoom level with the number of marks displayed? For example if the the zoom level is 0, e.g. 10 POIs is shown and when the zoom level is 10, all which can fit

Android OverlayItem.setMarker(): Change the marker for one item

家住魔仙堡 提交于 2019-12-05 04:52:47
Trying to change the marker from an overlay item I noticed the setMarker() makes the item not visible. Here's the code sample. //Create new marker Drawable icon = this.getResources().getDrawable(R.drawable.marker); //Set the new marker to the overlay overlayItem.setMarker(icon); A bounding rectangle needs to be specified for the Drawable: //Create new marker Drawable icon = this.getResources().getDrawable(R.drawable.marker); //Set the bounding for the drawable icon.setBounds( 0 - icon.getIntrinsicWidth() / 2, 0 - icon.getIntrinsicHeight(), icon.getIntrinsicWidth() / 2, 0); //Set the new marker

How to make an android app run in background when the screen sleeps?

夙愿已清 提交于 2019-12-04 20:13:01
I am developing a Tracking app, which keeps tracks of the user by getting his current location for every 3 secs. I am able to fetch the lat long values when the screen is on. but when the screen sleeps. i am unable to fetch the datas. CODE: @Override public void onLocationChanged(Location location) { mLastLocation = location; if (mCurrLocationMarker != null) { mCurrLocationMarker.remove(); } latitude = location.getLatitude(); longitude = location.getLongitude(); latLngcurrent = new LatLng(location.getLatitude(), location.getLongitude()); Toast.makeText(context,String.valueOf(latitude)+" "

Google Maps marker clusters in Android

◇◆丶佛笑我妖孽 提交于 2019-12-04 18:56:26
Is there any common way to implement marker clusters for Google Maps in Android apps? I have a database of about 10,000 locations and would like to display them in more intelligent ways than just dumping thousands of markers on a display that's rarely larger than a match box... Ideally, it should be possible to retrieve the markers from a website URL, though I'm not sure if using the usual Async functions for that even makes sense from a usability point of view. Clusterkraf would work for you. One of the options in Advanced Mode in the sample app is to cluster 10,000 random points worldwide.

Multiple map views?

坚强是说给别人听的谎言 提交于 2019-12-04 18:48:35
I have an application that has two map views one satellite and one street view. They both keep showing up as a satellite view even though one is set to setStreetView(true); and the other is set to setSattelite(true); . How would I get it so that both views show different maps? Thanks in advance. Morrison Chang Assuming you are talking about showing both at the same time, it doesn't appear to be possible. See How to Make 2 MapView on One Activity Updated to respond to comment. Per the Google Map API MapActivity , "Only one MapActivity is supported per process. Multiple MapActivities running

Getting latitude & longitude from address in android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 18:00:37
问题 i am try to get latitude & longitude from address , problem is that .. when i give only city name than it give me correct latitude & longitude and when i give complete address (like state , city name , street No.) than it do not give me correct latitude & longitude ... thanks for your cooperative response ... my code is .. //String addressStr = "faisalabad";/// this give me correct address String addressStr = "Sainta Augustine,FL,4405 Avenue A"; Geocoder geoCoder = new Geocoder(MapClass.this,

Android Map API V2 set Custom InfoWindow Position

纵饮孤独 提交于 2019-12-04 17:48:13
I'm using InfoWindowAdapter for all the markers on my Map (Api v2). All the Markers are well visible.. The issue is that My Custom InfoWindow is having size about 500px * 300px. When I'm touching any Points on the Map its being set to Center of screen so the InfoWindow is being cropped from Top.. My requirement is to auto adjust as per Info Window Size. Please have a look at snaps. MaciejGórski Override the default behaviour of OnMarkerClickListener . call marker.showInfoWindow() calculate position on which screen should be centered using Projection and position of the marker and animate

Subclassing SupportMapFragment results in a NullPointerException

这一生的挚爱 提交于 2019-12-04 17:47:06
问题 I'm currently implementing my own subclass of SupportMapFragment, using the google-play-services library r3. I get a NullPointerException in one of the internal classes of the library when I try to add my Fragment to an Activity or ViewPager . Here's the relevant stacktrace: java.lang.NullPointerException at maps.y.p.onResume(Unknown Source) at com.google.android.gms.maps.internal.IMapFragmentDelegate$Stub.onTransact(IMapFragmentDelegate.java:115) at android.os.Binder.transact(Binder.java:310

Android - Two Maps in one App

旧巷老猫 提交于 2019-12-04 17:44:22
I got an App where on main screen show google mapView. But I need also in details view show the map. I know that it is impossible to run two maps simultaneously. Everything is working when I want to show something on the main map and later in detailed view, but when I come back to main one, it stops. How to stop main map and come back later to it? Having two maps in one app produces many weird application behavior. For example, Ive had overlays from one map show up in the second map. That said, it is possible to have two maps in one application without the above happening. What you need to do

Google Maps v2 Error on use of setMyLocationEnabled

筅森魡賤 提交于 2019-12-04 15:28:53
I am not sure were I went wrong, getting a nullPointerException on using googlemap.setMyLocationEnabled(true) in Google Map v2 example. MainActivity.java File: package com.example.locationgooglemapsv2; import java.io.IOException; import java.util.List; import android.content.Context; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app