android-maps

Android GoogleMap or SupportMapFragment - null pointer exception

≡放荡痞女 提交于 2019-12-04 14:01:28
问题 In my app i showing google map version2 in a fragment. but i get Null pointer exception at mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); This is my full code: public class SearchResultMap extends Fragment{ private GoogleMap mMap; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View fragmentView

osmdroid, Maps API v2, and fragments

痞子三分冷 提交于 2019-12-04 12:18:47
问题 Ok. You'd think this would be relatively simple, but nope. I am using Open street maps on my website, as the data is free to use, edit, and update - my project follows this mantra, and alongside googles API usage restrictions/saving data restrictions, google maps simply was not suitable for me.. at least on the web. Given this I thought i'd follow suit with my android app, and so I setup osmdroid utilizing open street maps data. I can have a nice map in my activity.. I also followed a

OnClickListener for pushpin

元气小坏坏 提交于 2019-12-04 06:26:13
问题 Here I have used google map and an overlay. I have used an image of pushpin to point to the GeoPoint. I want to set an OnClickListener event for the push pin. When user touches the pin, I want to toast a message. Below is the code. import java.util.List; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import android.graphics.Bitmap;

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

Difference between public final void moveCamera (CameraUpdate update) and public final void animateCamera (CameraUpdate update)?

主宰稳场 提交于 2019-12-04 03:50:04
问题 What is the difference between the methods public final void moveCamera (CameraUpdate update) and public final void animateCamera (CameraUpdate update) of GoogleMap class? When should I call getCameraPosition()? 回答1: The difference between those two is that: animateCamera will animate the camera to the desired position with a smooth animation, while moveCamera will move the camera to the desired position instantly. Edit: From the docs of CameraPosition: An immutable class that aggregates all

Google map not showing when app is downloaded from playstore but showing fine when installed directly signed apk

假装没事ソ 提交于 2019-12-04 03:04:09
问题 I am facing an issue in google map.Google map is not showing when I download the apk from google play store but it works fine when I manually install(by transferring to device) same apk which was uploaded to play store. I have rechecked my debug and release keys which are present here Please find permission in manifest file: <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission

android - Geocoder.getFromLocationName() is not working in ICS device

↘锁芯ラ 提交于 2019-12-04 01:52:34
I have two devices. One is HTC WildFire S and other one is HTC 1V . I used the Geocoder.getFromLocationName() in my application. It is running successfully in the HTC wildfire S . But in the HTC 1V i got the following error. why it's came? How can i solve this? please can anybody help me. Code Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault()); //s is the address List<Address> addresses = geoCoder.getFromLocationName(s, 5); //Here i got the following Exception. Error 06-18 16:28:17.933: W/System.err(4960): java.io.IOException: Service not Available 06-18 16:28:17.953: W

Google Maps Android API v2 - MarkerOptions draggable and visible methods

假如想象 提交于 2019-12-03 15:55:50
I'm playing with the new Google Maps Android API (v2) released earlier this month and I was delighted to see a MarkerOptions.draggable(boolean draggable) method which I thought would create a draggable marker when passing in a draggable value of true . However, on trying it (i.e. adding a marker as such to the map), it doesn't seem to do anything. The MarkerOptions.visible(boolean visible) method too, which I thought would hide the marker from view when passing in a visible value of false . Anyone been able to get these methods to work? The latter issue is already in the Google Bug Tracker .

Save markers on Android google maps v2

[亡魂溺海] 提交于 2019-12-03 15:49:29
I am using Android Google maps v2 API and have it set up to add markers on long click. I need a way to save these markers and reload them when the app resumes again. What will be the best way to do this? Please help Currently I add markers as follows: map.addMarker(new MarkerOptions().position(latlonpoint) .icon(bitmapDescriptor).title(latlonpoint.toString())); CrashOverride I got it! I can easily do this via saving the array list of points to a file and then reading them back from file I do the following onPause : try { // Modes: MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITABLE

Night mode for Google maps?

大城市里の小女人 提交于 2019-12-03 09:28:45
问题 My question is simple. Is there a night mode for Google maps? So far I could only apply GoogleMap.MAP_TYPE_NORMAL | GoogleMap.MAP_TYPE_TERRAIN | GoogleMap.MAP_TYPE_SATELLITE but could not find Night Mode . I want something like this Please do not suggest me to use overlay , I already have tried. I cannot use it as I have to place markers on it. Came across this post but it is 2 years old and I guess there should be some improvement. 回答1: Google just announced having launched custom map