android-maps-v2

android google map marker placing

痞子三分冷 提交于 2019-12-04 03:52:49
In my Android application I need to place marker at exact position on map. I pin a marker on map with 51.507351, -0.127758 (London) location. I used the following code to do the work. googleMap.addMarker(new MarkerOptions().position( new LatLng(51.507351, -0.127758)).icon( BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(), R.drawable.q_icon)))); googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(51.507351, -0.127758), 20)); And this my marker drawable image: Now my problem is, the "Q" symbol is placed at the location of 51.507351, -0.127758. I need

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

风流意气都作罢 提交于 2019-12-03 16:02:54
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| |_||| || MAP | || || | || ||_____| || ||__________|| The error: 01-29 08:32:56.979: E/AndroidRuntime(27738):

How can i access all marker on my GoogleMap-Object (android maps v2) and set them (in)visible?

谁说我不能喝 提交于 2019-12-03 15:14:36
问题 i am currently trying to implement an ActionBar-Button that on usage sets all my markers on my GoogleMap-object visible or invisible. My problem is that i don't know how i can get a reference to all my markers once they have been created and are shown on my map. Im looking for a solution where i stash all my marker-objects into an array, that i can access in other parts of my code aswell. is this approach reasonable? here is what i am thinking of: private Marker[] mMarkerArray = null; for

Android Maps - animateCamera() method not working proper

爷,独闯天下 提交于 2019-12-03 14:13:58
Problem: 1) Map getting animated to reach the required location(4th line in code) but it got zoomed to the default location(5th line in code) [leaving the map in the default location at the specified zoom level] 2) I understand why is the problem happening but i don't know how to resolve it. 3) If i change the 4th line to moveCamera instead of animateCamera that will work, but i do want animateCamera() method. Here's the code: map=((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap(); MarkerOptions options=new MarkerOptions().position(new LatLng(13.0810,80.2740)); map

Google Maps v2 Projection.toScreenLocation(…) extremely slow

人走茶凉 提交于 2019-12-03 14:02:46
I have upgraded Google Maps v1 to v2 in my Android application. And v2 was nice and so on BUT one method seems to be the slowest thing in my life. Projection proj = map.getProjection(); Point point = proj.toScreenLocation(example.m_geopoint); toScreenLocation(...) is so slow so the application slow downs to unusable slowmotion. The method updated maybe 100 times per frame but that works very very great on Google Maps v1. And when I check in Android Console I see this: 10-06 13:53:04.460: D/dalvikvm(4889): GC_EXPLICIT freed 251K, 14% free 14622K/16839K, paused 3ms+5ms 10-06 13:53:05.859: D

The import android.support.v7.app.MediaRouteActionProvider cannot be resolved

自古美人都是妖i 提交于 2019-12-03 12:24:57
I am trying to use GoogleMap V2 .But i am getting error on import these : import android.support.v7.app.MediaRouteActionProvider; import android.support.v7.media.MediaRouteSelector; import android.support.v7.media.MediaRouter; import android.support.v7.media.MediaRouter.RouteInfo; And the error is The import android.support.v7.app.MediaRouteActionProvider cannot be resolved Here is the screen shot of the library that i have added What i have to do .I have tried to import android\support\v7 By Build path .But it is not resolving my issue in there any way so that i can resolve these errors. It

Draw a custom shape in android using XML

主宰稳场 提交于 2019-12-03 10:08:50
问题 I am adding a custom marker to the android map view. here is the image I am using for it.It looks like as more markers are placed say about 100 the entire app is getting slow. Here is the image I am using for that. Instead of using this image, I am planning to draw this image as a shape in XML. How to do that? Also I am following this tutorial to display a custom marker. Is this custom drawing delaying the app? Whats the best way to do it? 回答1: It's possible, but looks like does not make

Android maps V2 newLatLngBounds with bearing

邮差的信 提交于 2019-12-03 10:01:42
I'm using the new Android maps V2 with this layout: <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" map:cameraBearing="270"/> I'm trying to use the method newLatLngBounds (LatLngBounds bounds, int padding) for zooming and seeing all my markers in the map, however the camera bearing is set to 0. The description on google developers documentation says: public static

Map and Moving Marker using Google Maps API

允我心安 提交于 2019-12-03 09:02:16
I have to write a demo , that should work like Moving Map within Flight and need to draw same curved Polyline between two geo points / locations as you can see in below image . Even, I would not mind switching to some other SDK like Mapbox SDK (If someone of you can really help me in getting What I need actually) To draw a Polyline between two points, I am using: private void polyLine() { LatLng starting = new LatLng(##.######, ##.######); LatLng ending = new LatLng(##.######, ##.######); PolylineOptions line = new PolylineOptions().add(starting, ending); mGoogleMap.addMarker(new MarkerOptions

getSupportFragmentManager() method is undefined for type MapFragment

房东的猫 提交于 2019-12-03 08:55:39
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) { View root = super.onCreateView(inflater, container, savedInstanceState); SupportMapFragment mapFrag=