google-maps-android-api-2

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

依然范特西╮ 提交于 2019-11-28 10:28:20
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(savedInstanceState); return v; } } Edited: And the xml: <LinearLayout xmlns:android="http://schemas.android

Draw driving route between 2 GeoPoints on GoogleMap SupportMapFragment

為{幸葍}努か 提交于 2019-11-28 09:33:26
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=");// to urlString.append(dest); urlString.append("&mode=driving&sensor=true&units=imperial"); // get

Trying to get maps v2 Android demo working

柔情痞子 提交于 2019-11-28 08:58:33
问题 New to Android etc. So I was recommended this demo: http://dj-android.blogspot.in/2013/02/android-google-map-v2-part-1.html I followed it, but something must have gone wrong. ... In workspace I have my own project: Inside this project: In "Libs" I have added "android-support-v4.jar" Inside this project: In Android Depencides I have "android-support-v4.jar" Inside this project: In References Libraries I have "google-play-services.jar" Inside this project: In References Libraries I have

Google Maps Android API v2 creating a new LocationSource

萝らか妹 提交于 2019-11-28 08:42:26
A LocationSource is defined in Google Maps Android API v2 . It is used for googlemap as the location provider. By default, the location source is provided by the gps module on the phone. But now I want to use a another Location source , the location data will be sent to android device periodically. I have no idea how to implement this interface. Are there any example out there? Can anyone help me with it? The document did not say anything about it. Here is a simple implementation of LocationSource interface. In my case I'm registering both GPS and Network location providers. As mentioned by

Google Map Android Api V2 Sample Code not working

那年仲夏 提交于 2019-11-28 08:28:39
I had tried to use the Google Map Sample Code before which was provided in Google_Play_SERVICE/SAMPLE by using all the available options and it showed the below Log. 01-14 17:58:39.773: E/Google Maps Android API(13114): Authorization failure. It showed me the blank screen for all of the sample Map options. Now I created a new Project and here is its complete code:- Activity.java public class MapActivity extends FragmentActivity { private Context context = this; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

How to implement search functionality for Google Map Api V2 Android?

烂漫一生 提交于 2019-11-28 08:18:24
问题 I need to implement a search functionality for my Android Google Map Api V2 project and can't find any working example. I just need to enter a city name, press a "Search" button and then the map should move to the city and show a marker on it. Just like the Google Maps application does. Autocompletion should be nice though. I actully get to show the map, show some markers, etc, I just can't get to perform the search and see the results. Please help! Thanks in advance 回答1: I just need to enter

Android Google Map API V2 Blank Screen

℡╲_俬逩灬. 提交于 2019-11-28 08:14:15
Hi I recently followed Vogella's tutorial on Google Map API v2. The code is similar to his. But for some reason the map shows up blank and the logcat shows no error either. I also followed this video to get the SHA1 finger print then I put the API key inside the manifest file. I used the debug keystore C:\Users\UserName.android\debug.keystore which is also the default debug keystore located in Eclipse -> Windows -> Preference -> Android -> Build. I also generated a new API key and it still doesn't work. Manifest file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package

Google Maps API Android v2 - “ACCESS_FINE_LOCATION” permission required with my-location layer enabled

♀尐吖头ヾ 提交于 2019-11-28 08:06:43
问题 I want to show the location of the user on a Google Maps enabling my-location layer, but this functionality requires the "ACCESS_FINE_LOCATION" permission to get the location from the GPS. Is it possible to prevent the GoogleMap from trying to get the location from the GPS? If I remove the permission "ACCESS_FINE_LOCATION" in the Manifest file, as soon as I try to display the map, the app crashes with the following error: E/AndroidRuntime(28578): FATAL EXCEPTION: main E/AndroidRuntime(28578):

Can not install google-play-services into Eclipse correctly (trying to get maps working)

↘锁芯ラ 提交于 2019-11-28 07:56:43
问题 My current wokspace setup looks like this: However, people have told me that to get maps working, I also need to have "google-play-services_lib.jar" in my "Android Dependencies" folder, and the way to do that was through doing: "to Google Play Services into your project Project -> Properties -> Android -> Library, Add -> google-play-services_lib " The only problem with that is it always after the initial green marker , it turns to a red cross when re-opening "Project -> Properties -> Android

Displaying multiple routes using Directions API in Android

独自空忆成欢 提交于 2019-11-28 07:47:29
I am using this class to display a route on a map. The problem is that it only displays one route. What I want to do is display multiple alternate routes on the map. Even thought the server response has multiple routes, it only parses the first route and displays it. What changes should I make to display all the routes that the google server returns.Here is my class. public class GMapV2Direction { public final static String MODE_DRIVING = "driving"; public final static String MODE = "walking"; public final static String MODE_WALKING = "walking"; public GMapV2Direction() { } public Document