android-mapview

Mark current location on google map

断了今生、忘了曾经 提交于 2019-12-06 11:55:06
How to mark my current location on google map? I am using google place API. I have to show all near places from my current position. All places are showing on google map, but how to show my current position? The code is given below: public class PoliceStationMapActivity extends FragmentActivity implements LocationListener { private ArrayList<Place> mArrayListPoliceStations; private GoogleMap mMap; private LocationManager locManager; private double latitude; private double longitude; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Animate markers on Google MapView

放肆的年华 提交于 2019-12-06 10:51:20
I am working on an Android app that displays multiple markers on a Google MapView. Everything works perfectly but I would like the markers to have an animation when they appear on the map. Here's an example of something similar on iPhone. See 1'20". Here is how I add them to my MapView. for(int i=0; i<myMarkerList.length(); i++){ GeoPoint x = new GeoPoint( (int)(lat*1E6), (int)(lng*1E6)); oItem = new OverlayItem(x, title, String.valueOf(nb_marker)); pin.setAlpha(255); oItem.setMarker(pin); if (oItem != null) mapOverlay.addOverlay(oItem); // add the overlay item to the overlay } mapOverlays.add

mapView not zooming on second try using didUpdateUserLocation

一个人想着一个人 提交于 2019-12-06 09:54:09
i am loading a mapviewcontroller when the view map button is pressed from my mainviewcontroller: - (IBAction)mapButton:(id)sender { MapKitDisplayViewController *mapKitDisplayView = [[MapKitDisplayViewController alloc] init]; [self presentModalViewController:mapKitDisplayView animated:YES]; [mapKitDisplayView release]; mapKitDisplayView = nil; } On startup of this map view this method is called, which correctly zooms to the users location: - (void)mapView:(MKMapView *)myMapView didUpdateUserLocation:(MKUserLocation *)userLocation { myMapView.showsUserLocation = YES; NSLog(@

MapView v2 snapshot() creates an unfinished Bitmap

帅比萌擦擦* 提交于 2019-12-06 09:06:12
I'm using the new snapshot() method on the GoogleMap object, and in my SnapshotReadyCallback I'm swapping out the MapView in my layout for an ImageView with the Bitmap passed to me from the callback. The unfortunate thing about this is, even though I'm getting a Bitmap it appears that the snapshot was taken before the map finished rendering. I should also add that this View is being created programmatically, and isn't added to the Activity right away (it's actually being placed in a ScrollView with a bunch of other Views). The gist of my code (for brevity's sake) is: public class MyCustomView

android - map in listview header

非 Y 不嫁゛ 提交于 2019-12-06 04:30:22
In my app i have an activity which contains a image and a list view at the bottom. Following are the things to be done in the activity. 1. the image view at the top of the page must be of swipe type to show other images. 2. when the list view gets scrolled the image must get moved along with it. 3. in the same activity i have a button, when the button is clicked the image must be switcher over to be a mapview. What i have done is, 1. I have the image view and mapview in view switcher of a separate layout named as header 2. The header layout is been added in the list view header part. Now the

Android map v2 error on second inflating

落花浮王杯 提交于 2019-12-06 03:49:46
问题 I'm trying to use new android maps in my app. I've got a FragmentActivity which layout contains (among other things): <LinearLayout a:id="@+id/fragment_container" a:layout_width="fill_parent" a:layout_height="100dp" a:layout_weight="1"/> It also has a button which changes this fragment using (mostly copied from sample project): if (condition) { fragment = new Fragment1(); } else { fragment = new LocationFragment(); } FragmentManager fragmentManager = getSupportFragmentManager();

How to update MapView overlay items from an AsyncTask without ArrayIndexOutOfBoundsException

那年仲夏 提交于 2019-12-06 03:33:55
I am using a MapView which needs a number of overlay items added to it. I'm finding adding the overlay items is slow and causes the map to ANR when dragged. So I built an AsyncTask to add the overlay items. Initially I found it failed consistently as I was accessing the overlay collection from a background thread, and I gather it is not thread safe. So I changed it so the overlays are only changed from the UI thread. It now works, but only most of the time. It still crashes very occasionally when the map is touched. Here's the AsyncTask (an inner class inside my subclass of MapView): class

android swipe Horizontal View Paging with MapView

坚强是说给别人听的谎言 提交于 2019-12-06 01:44:31
I have an android app with a view that contains 3 pages between which the user can navigate through swiping his finger (to the left or to the right - Horizontal View Paging). I downloaded “android.support.v4.view.ViewPager” and found the way to implement the swiping part mostly thanks to this tutorial here: http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/ My problem is that I want one of my views to launch a MapView. But to launch a MapView I need an activity that extends the MapActivity. If I have all my “RecordAdapter” class in a MapActivity

How do I find the center of multiple points? Android

谁说胖子不能爱 提交于 2019-12-06 01:29:16
I have multiple points placed on my MapView and would like to centre the map on these points i.e. not any particular one, just the averaged centre of the lot of them. I know there's a method for this in the Javascript G. Maps API. I was wondering whether there was a prexisting method to do this in Android? Someone Somewhere this question looks suspiciously like one I had some time ago ... Android MapView -setting zoom automatically until all ItemizedOverlay's are visible What you are trying to calculate is called a Centroid . There are several Java implementations for calculating centroids for

MapView google maps NullPointerException?

一曲冷凌霜 提交于 2019-12-06 00:05:44
I'm trying create a How to get using MapView. I created a Fragment and a XML to use that. The problem is when I try open the MapView throws a NullPointerException but I can't undertand why. How could I solve it ? XML <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <com.google.android.gms.maps.MapView android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="160dp" android:layout_marginRight="10dp" /> </LinearLayout> The Fragment public