android-mapview

MapView in Fragment ( Android 4.0 or higher)

天涯浪子 提交于 2019-12-17 19:28:30
问题 I've been looking for a while to find a good tutorial with code example for a MapView in Fragment for ICS. Anyone have any links? 回答1: Here is a book's sample application showing how to have a MapView in a Fragment in an API Level 11+ app. It's mostly just a MapActivity . Here are the key bits of the fragment that loads the MapView : public class MapFragment extends Fragment { private MapView map=null; private MyLocationOverlay me=null; @Override public View onCreateView(LayoutInflater

Draw driving route between 2 GeoPoints on GoogleMap SupportMapFragment

£可爱£侵袭症+ 提交于 2019-12-17 19:27:32
问题 This is a tricky question, been banging my head for a day, please help. I use Google Maps Apis to get the shortest driving distance and its routes, points, etc between 2 GeoPoints that I provide, see code below private JSONObject GetDistance(String src, String dest) throws Exception { StringBuilder urlString = new StringBuilder(); urlString.append("http://maps.googleapis.com/maps/api/directions/json?"); urlString.append("origin=");// from urlString.append(src); urlString.append("&destination=

How to retrieve current device location & show it on map fragment in a fragment

空扰寡人 提交于 2019-12-17 19:25:57
问题 I'm developing a android app with google maps. Currently I'm able to view the map inside my app, but I don't know how to view the current location on the app. Here is my code: public class MapsFragment extends Fragment{ MapView m; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // inflat and return the layout View v = inflater.inflate(R.layout.map_near_me, container, false); m = (MapView) v.findViewById(R.id.map); m.onCreate

How can I determine if a geopoint is displayed in currently viewable area?

强颜欢笑 提交于 2019-12-17 15:39:33
问题 Say I have mapview control in my Android app. If I know a landmark exists at a certain latitude and longitude, how can I determine if that landmark is currently viewable on the user's screen? Is there a method for getting the coordinates for the top left and bottom right corners of the visible area? 回答1: You can project GeoPoint to Point and check if it is box (0, screen width) by (0, screen height) See: https://developer.android.com/reference/com/google/android/gms/maps/Projection.html 回答2:

Should I use MapView or MapFragment

你。 提交于 2019-12-17 15:29:29
问题 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

How can I use a custom bitmap for the “you are here” point in a MyLocationOverlay?

ぃ、小莉子 提交于 2019-12-17 10:57:16
问题 I've poured over the docs and haven't been able to figure this out. Is it even possible? Please see this 回答1: It looks like the correct mechanism to do this is to extend MyLocationOverlay then override the drawMyLocation() protected method. The following uses an arrow to show where "you" are and which way "you" are pointing: package com.example; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android

Shared library missing in android.

♀尐吖头ヾ 提交于 2019-12-17 10:35:42
问题 02-18 00:02:08.432: ERROR/PackageManager(57): Package com.example.brown requires unavailable shared library com.google.android.maps; failing! I got this exception in logcat. Can anyone guide me? 回答1: As CommonsWare said, your emulator is missing the library. The Google Maps Library's documentation's Overview page has info on how to create the right kind of virtual device for the emulator. The gist is: Launch the AVD Manager by using the android command without any options. If you are

Comparing two locations using their Longitude and Latitude

半腔热情 提交于 2019-12-17 10:34:41
问题 Hi i need to cal an event at onchangelocation(), by comparing current latitude and longitude with some saved latitude and longitude but i m getting an error. eclipse is not recognizing key word distance, and for correction error it is giving hint to crate method "distance" having 4 parameter ... how to fix it??? or some other way to do same work??? thanks and regards. code is attached below @Override public void onLocationChanged(Location location) { double currentLat=location.getLatitude();

Google Maps Android API V2 check if GoogleMaps are installed on device

谁都会走 提交于 2019-12-17 10:25:34
问题 When using Google Maps Android API V2 I'm following the Google Play Services setup documentation to make a check to ensure that Google Play Services are installed, using the following code in my main Activity: @Override public void onResume() { checkGooglePlayServicesAvailability(); super.onResume(); } public void checkGooglePlayServicesAvailability() { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(resultCode != ConnectionResult.SUCCESS) { Dialog dialog =

Android “Hello, MapView” Tutorial - Map Tiles Do Not Load

杀马特。学长 韩版系。学妹 提交于 2019-12-17 09:56:43
问题 I am new to Android software development and new to this site. I am hoping someone might have some experience with the problem I am having. I've been following the Hello, MapView tutorial in order to not only learn the Android framework, but also the Google Maps library. I've tried my best to implement things exactly as the tutorial has instructed. My problem is that the application does load in my emulator (or even on my phone for that matter), but the map tiles do not load. Searching Google