fast map loading issue with multiple markers in android? - android

I have problem in loading map with multiple marker in samsung epic.map will display after some time.pls give me the solution.
Thanks.

Google maps are dynamically loaded from internet. This is where the delay comes from. Check you internet connection.

If you are using map only for marker display purpose use lite map special feature by google map Lite Mode
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:cameraZoom="13"
map:mapType="normal"
map:liteMode="true"/>
map:liteMode="true" it will make map in lite mode with some limitation
AND
For too many marker go with clustering of marker google link
clustering will increase readability of map
BEFORE CLUSTER
AFTER CLUSTER

Related

Map generated in Cloud-based Maps Styling v3 does not work properly

After switching from maps v2 to v3 (due to Cloud-based Maps Styling) I get this result in Light Mode (as in the screenshot)
The map is as if covered by some black block (but this place is clickable -> maybe the phone is breaking something graphically)
If I change to Dark Mode on my phone it works fine
Map Fragment in Activity
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.libraries.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
map:mapId="#string/map_id"
android:layout_weight="1" />
Can something be done about it?

Google Maps works in debug not in apk

I added a map to a layout with a text view on top of it. In debug when I run the app on my phone the map comes up as expected. I pass my current longitude and latitude to the intent and the map centers on my location. The text view is visible and I can drop and pin and get the new coordinates.
I wanted to share the apk with someone so I first generated the file and emailed it to myself. After downloading and installing on my phone as a test I noticed the map no longer displays. There are no exceptions thrown. The text view is visible and the small 'Google' logo is in the bottom right, so the map there, but it is just a white screen. There is no map image. I tried to pinch thinking I am too zoomed in or out, but nothing changes.
Below is the layout of the activity. When I view it in design mode there is rendering problem. Part of the output from the rendering exception is below. the exception was 1025 lines long, which made it too long for a SO post. It was a lot of repeat, so i cut it down. I'm not sure if the two issues are related.
Is there anything wrong with my layout that would account for the problems? The phone shows that the app has the correct permissions for Location services.
I'm in Android Studio 1.4.0/ SDK 23
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="match_parent" android:id="#+id/map" tools:context=".GarbageLocator"
android:name="com.google.android.gms.maps.SupportMapFragment"
tools:layout="#layout/activity_garbage_locator" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin">
<TextView
android:id="#+id/ItemName"
android:text="#string/hunt_item"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:textSize="32sp"/>
</RelativeLayout>
</FrameLayout>
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.parsers.SecuritySupport.getSystemProperty(SecuritySupport.java:62)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:229)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
at com.android.utils.XmlUtils.parseDocument(XmlUtils.java:432)
at com.android.utils.XmlUtils.parseDocumentSilently(XmlUtils.java:484)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.findCycles(LayoutlibCallbackImpl.java:397)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.getParser(LayoutlibCallbackImpl.java:315)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.getParser(LayoutlibCallbackImpl.java:306)
at android.content.res.BridgeResources.getLayout(BridgeResources.java:396)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:135)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:879)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:831)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:197)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:879)
Part of the mystery solved. The rendering problem is because when I clicked on the design tab AS asked me to choose which layout I wanted to display in the fragment, so I chose the layout for the activity. AS then added the line 'tools:layout="#layout/activity_garbage_locator"' to the layout, which I guess caused a sort of circular reference. Ugh!
Also, after adding the new API key the map no longer works in either Debug or Release. Consistency in failure is progress, I guess. I added a new activity with a Google map and ran it as-is, that is to say, without any additional code, and it won't display a map either. I get the same thing: an off-white screen with the Google logo in the bottom left. Just as I would get if there was a map, but no map.
In my original activity with code to trap the longitude and latitude of a dropped pin, the map actually does work in that it returns a new longitude and latitude when I tap on the screen. It just doesn't show the stupid map!
Greg
It was an API issue, but I'm not really sure what was going on. I tried several different things after reading several different posts regarding this problem. I think what fixed it was hard coding the API key in the manifest, as one post suggested.
Original manifest entry
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
Change to
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIz_MY_ACTUAL_KEY" />

I am using google Map fragment twice in my android app and getting this error

here is my logcat screen shot i am getting this error please tell me how to use google map fragment two time?
How do you add your fragment?
The best way to do it is:
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment" />

Android Google Maps V2: Only Loads after zooming

I just started programming my first Android app. However, even after thouroughfully following the Google Tutorial, including (!) getting a valid API key, the Google Maps doesn't load from the beginning (that means I can only see the grid).
The tiles are (weird?) only loaded after I use finger gestures (+- does not work) to adjust the zoom to a (random?) level. I don't have any idea on what could be the matter...once the first tile got loaded, the app works as expected.
I already worked through StackOverflow, the problem with everybody else was they were using MapView (V1).
I'm using
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment" />
however...

Can I disable multi-touch zooming in GooglMap API2

Is it possible to disable/enable multi-touch zoom in GoogleMap API 2? I like to implement it programatically disable or enable when it is necessary.
Thanks
Multi touch zooming is typically handled on a system level. You could have a toggle for turning zooming on/off, but not multitouch specifically (to my knowledge).
You should be able to toggle zooming in general with:
disableScrollWheelZoom();
And:
enableScrollWheelZoom();
You could perform a check for user agents (mobile) and disable it by default for those, then give the option to enable it.
To Disable the multituch zooming you can use this in the XML file:
map:uiZoomGestures="true"
you will have to add the map namespace in order to use it like this:
xmlns:map="http://schemas.android.com/apk/res-auto"
in your fragment xml code:
<fragment
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:uiZoomGestures="true"
same can be done in JAVA code:
map.getUiSettings().setZoomGesturesEnabled(false);

Categories

Resources