What i am doing::
I am using mapquest widget and api for maps
I am haveing the mapwidget inside the scrollview
I am able to click the map markers in the map also
What is happening::
I am not able to to zoom the map,
I can see zoom buttons clickit also but it wont zoom
code::
MyFragment.java
public class MyFragment extends Fragment{
protected MapView map;
AnnotationView annotation;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment, container,false);
map = (MapView) rootView.findViewById(R.id.map);
map.getController().setZoom(10);
map.getController().setCenter(new GeoPoint(12.918609,77.668912));
map.setBuiltInZoomControls(true);
// initialize the annotation to be shown later
annotation = new AnnotationView(map);
//addPolyOverlay();
// addLineOverlay();
return rootView;
}
#Override
public void onStart() {
// TODO Auto-generated method stub
super.onStart();
addPoiOverlay();
}
// add an itemized overlay to map
private void addPoiOverlay() {
// use a custom POI marker by referencing the bitmap file directly,
// using the filename as the resource ID
Drawable icon = getResources().getDrawable(R.drawable.distance_icon_large);
final DefaultItemizedOverlay poiOverlay = new DefaultItemizedOverlay(icon);
// set GeoPoints and title/snippet to be used in the annotation view
OverlayItem poi1 = new OverlayItem(new GeoPoint (12.918609,77.668912), "Denver, Colorado", "MapQuest Headquarters");
poiOverlay.addItem(poi1);
OverlayItem poi2 = new OverlayItem(new GeoPoint (12.956868,77.701148), "Palo Alto, California", "AOL Offices");
poiOverlay.addItem(poi2);
// add a tap listener for the POI overlay
poiOverlay.setTapListener(new ItemizedOverlay.OverlayTapListener() {
#Override
public void onTap(GeoPoint pt, MapView mapView) {
// when tapped, show the annotation for the overlayItem
int lastTouchedIndex = poiOverlay.getLastFocusedIndex();
if(lastTouchedIndex>-1){
OverlayItem tapped = poiOverlay.getItem(lastTouchedIndex);
annotation.showAnnotationView(tapped);
}
}
});
map.getOverlays().add(poiOverlay);
}
}
fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.mapquest.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="700dp"
android:apiKey="My-Key"
android:focusableInTouchMode="true"
android:clickable="true"
android:padding="5dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
You may need to override the touchlistener in the scrollview and then forward those events to the mapview if appropriate. The problem is that the scrollview is taking over the touch listener without properly forwarding it out.
mapview inside of a scrollview seems messy though....
Related
I use the PanoramaGL Library (https://code.google.com/p/panoramagl/) to display spheric 360° Images.
What I want:
The top half of the screen should contain a OSMdroid-Map (https://osmdroid.net/) and the bottom half shows panoramic images with PanoramaGL like this:
Problems:
You create panoramic Views in PanoramaGL using the class PLView which extends Activity.
If you show a panoramic image it always occupies the whole screen, and I see no way to change the layout. As soon as I try to define any xml-Layout, the panoramic image does not show up anymore.
My current code, where the map-part is commented out, so that only the panoramic image is displayed:
package com.example.campusnav;
//lots of imports...
public class MainActivity extends PLView {
private MapView mMapView;
private MapController mMapController;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.mapview);
mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
mMapController = (MapController) mMapView.getController();
mMapController.setZoom(13);
GeoPoint startPoint = new GeoPoint(52.432846, 8.369147);
mMapController.setCenter(startPoint);*/
PLSpherical2Panorama panorama = new PLSpherical2Panorama();
panorama.setImage(new PLImage(PLUtils.getBitmap(this, R.raw.p_1), false));
this.setPanorama(panorama);
}
}
Any suggestions how to work around this problem? Is there a way to display two seperate activities arranged in a vertical layout?
yes you can display both Panorama and map together
Extend your activity from PLView
XML
<RelativeLayout
android:id="#+id/rl_streetview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="1"
android:background="#00FF40" >
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_mapview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl_streetview"
android:layout_margin="0dp"
android:layout_weight="1" >
<fragment
android:id="#+id/location_map"
android:layout_width="match_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
Activity
#Override
protected View onContentViewCreated(View contentView) {
ViewGroup mainView = (ViewGroup) this.getLayoutInflater().inflate(R.layout.activity_main, null);
rl_streetview = (RelativeLayout) mainView.findViewById(R.id.rl_streetview);
rl_mapview = (RelativeLayout) mainView.findViewById(R.id.rl_mapview);
}
I'm having trouble setting up a ViewPager using a PageTransformer and a MapView. The problem is when the viewpager is set to use the PageTransformer, the mapview disappears(goes transparent) while panning. However, if I don't use a transformer and just pan the Mapview is fine. Does anyone know what is causing this behavior?
Currently the PageTransformer does nothing special but just setting it seems to affect the way the mapview is drawn. I should note that the map goes transparent while the mapview(Legal Notice)remains. When the ViewPager enters an Idle state the Map appears.
viewPager.setPageTransformer(true, this);
...
#Override
public void transformPage(View view, float position) {
}
XML: ViewPager Fragment
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<com.google.android.gms.maps.MapView
android:id="#+id/mapcontainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"/>
</FrameLayout>
Map Fragment:
private GoogleMap map;
private MapView mapView;
private Bundle mapBundle;
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
mapBundle = savedInstanceState;
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.mapfragment, container, false);
MapsInitializer.initialize(getActivity());
mapView = (MapView) rootView.findViewById(R.id.mapcontainer);
mapView.onCreate(mapBundle);
map = mapView.getMap();
return rootView;
}
#Override
public void onResume(){
super.onResume();
mapView.onResume();
}
#Override
public void onPause(){
super.onPause();
mapView.onPause();
}
#Override
public void onDestroy(){
super.onDestroy();
mapView.onDestroy();
}
I found a solution from the discussion thread Bug: Black rectangle background on scroll that pointed me in the right direction. There seems to be some bugs in Google Play Services that can be resolved by setting the map to "Lite Mode". In my case it did the trick and the map is now working in the pagetransformer. From what I understand lite mode changes the map to a Bitmap Image. You can read more about it here Google Maps - Lite Mode. Lite mode has some limitation such as not being able to pan or zoom, but in my case it is not a requirement.
I updated my XML to this:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<com.google.android.gms.maps.MapView
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/mapcontainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
map:liteMode="true"/>
</FrameLayout>
You can also set this option in the code:
GoogleMapOptions options = new GoogleMapOptions().liteMode(true);
MapView mapView = MapView (context, options);
so I am currently doing a navigation application where I need to display several tabs, one of which show a google map.
I have used FragmentPagerAdapter to set up the multi-pages UI and so far for the 2 remaining fragments which do not implements any other nested fragment, it works just fine.
For the map fragment, I noticed the problem of nested fragment, so I followed this guide: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5064#c1 and put the things accordingly into my MapFragment, however, the Fragment does not show me anything, it is just a blank page (I have some other things in that fragment, not just the google map fragment).
Please see where I made mistake, thank you very much :) If you need any other part of the code please tell me.
Here is the code of the Map Fragment
public class MapFragment extends FragmentControl implements OnSeekBarChangeListener{
public static MapFragment getInstance() {
if(MapFragment.instance==null) {
Log.e(TAG,"Map Fragment is not loaded");
}
return MapFragment.instance;
}
public static MapFragment newInstance(int position, String title){
MapFragment mapFragment = new MapFragment();
Bundle args = new Bundle();
args.putInt("current_page", 1);
args.putString("page_tile", "Map Information");
mapFragment.setArguments(args);
return mapFragment;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCurrentPage = getArguments().getInt("current_page", 1);
pageTitle = getArguments().getString("page_title");
MapFragment.instance=this;
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
layout = inflater.inflate(R.layout.map, container, false);
if (layout==null){
Log.d(TAG,"layout null");
return null;
}
CheckBox camera = (CheckBox)layout.findViewById(R.id.cameraMove);
camera.setChecked(MapFragment.moveCamera);
camera.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
MapFragment.moveCamera = isChecked;
}
});;
mTransparencyBar = (SeekBar)layout.findViewById(R.id.transparencySeekBar);
mTransparencyBar.setMax(TRANSPARENCY_MAX);
mTransparencyBar.setProgress(0);
markerList = new ArrayList<Marker>();
return layout;
}
#Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
super.onActivityCreated(savedInstanceState);
FragmentManager fm = getChildFragmentManager();
supportfragment = (SupportMapFragment) fm.findFragmentById(R.id.googlemap);
if (supportfragment == null) {
supportfragment = SupportMapFragment.newInstance();
fm.beginTransaction().replace(R.id.googlemap, supportfragment).commit();
fm.executePendingTransactions();
}
}
#Override
public void onResume() {
super.onResume();
this.createUiMap();
mapTimer = new Timer();
mapTimer.scheduleAtFixedRate(new updateCalculationTask(), 0, 100);
mapTimer.scheduleAtFixedRate(new updateUITask(), 50, MainActivity.uiUpdateRate);
}
void createUiMap() {
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = supportfragment.getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
populateMapStartPointsSpinner(layout);
setStartPointSpinnerListener(layout);
this.setUpMarker(this.defaultStartPoint.x, this.defaultStartPoint.y);
FetchSQL.setDRFixData(this.setLocation(defaultStartPoint));
}
}
}
private void setUpMap() {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(NEWARK, 20));
mImages.add(BitmapDescriptorFactory.fromResource(R.drawable.i3f2));
mCurrentEntry = 0;
LatLngBounds newarkBounds = new LatLngBounds(
new LatLng(1.291926, 103.775114), // South west corner
new LatLng(1.292833, 103.776310)); // North east corner
mGroundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions()
.image(mImages.get(mCurrentEntry))
.positionFromBounds(newarkBounds));
mTransparencyBar.setOnSeekBarChangeListener(this);
}
}
And here is the map.xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<CheckBox
android:id="#+id/cameraMove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cameraMove"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
<TextView
android:id="#+id/mapStartPointSpinnerLabel"
android:layout_marginLeft="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/cameraMove"
android:layout_toRightOf="#id/cameraMove"
android:text="#string/mapStartPointSpinnerLabel" />
<Spinner
android:id="#+id/mapStartPointSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/cameraMove"
android:layout_toRightOf="#id/mapStartPointSpinnerLabel" />
<LinearLayout
android:id="#+id/seekbarmenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/mapStartPointSpinnerLabel"
android:orientation="horizontal"
android:layout_marginTop="15dip">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/transparency"
android:layout_gravity="center_vertical" />
<SeekBar
android:id="#+id/transparencySeekBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/seekbarmenu"
android:layout_marginTop="15dip" >
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dip"
class="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/googlemap" />
</LinearLayout>
How it is supposed to look like (inside Eclipse View):
How it is on my phone:
Update: After some times looking through the internet, I suspects that the problem comes from the inflating part of the code (if not at least it should show something). May be to in inflate a Relative layout, you need to have some special code than when you inflate a Linear Layout.
All the codes I found is for Activity inflation, if anyone know how to inflate a Relative Layout in Fragment, please help. Thank you :)
from android developers :
Note: You cannot inflate a layout into a fragment when that layout includes a <fragment>. Nested fragments are only supported when added to a fragment dynamically.
So, instead of <fragment> element use some container view (FrameLayout for example) for adding fragment dynamicly
Update: My problem comes from the most unexpected place, I declare a getView() function in the MapFragment which seems to be overriding a function in Fragment class and everything get wrong from that part. Just delete the function out and it will work like a champ.
This do shows me that error can come from place where you dont expect (What I do is to comment the whole thing out then test block by block till I find the part that makes my program goes wrong).
Thank you very much for others to reply to me. Very appreciate your help :)
I'm using GoogleMap V2 and I have a gridView and a mapView like that:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1" >
<com.google.android.gms.maps.MapView
android:id="#+id/map_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5" />
<GridView
android:id="#+id/gv_all_pubs"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"
android:background="#color/BurlyWood"
android:columnWidth="300dp"
android:horizontalSpacing="5dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:verticalSpacing="3dp" />
</LinearLayout>
</FrameLayout>
the code is that:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = null;
try
{
view = inflater.inflate(R.layout.all_pubs_layout, container, false);
mapView = (MapView)view.findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);
map = mapView.getMap();
//set the map options
map.setMyLocationEnabled(false);
map.getUiSettings().setMyLocationButtonEnabled(false);
map.getUiSettings().setZoomControlsEnabled(true);
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.getUiSettings().setCompassEnabled(true);
try
{
MapsInitializer.initialize(mContext);
}
catch (Exception e){}
gvAllPubs = (GridView)view.findViewById(R.id.gv_all_pubs);
gvAdapter = new AllPubsGridViewAdapter(mContext, App.pubSortedByLastUpdate);
gvAllPubs.setAdapter(gvAdapter);
gvAllPubs.setOnItemClickListener(gridViewClickListener);
//select the first item in the list
try
{
gvAllPubs.setSelection(lastPubSelected);
drawLastPubSelected(lastPubSelected);
}
catch (Exception e) {}
}
catch(Exception e){}
return view;
}
and the gridview item click listener is:
OnItemClickListener gridViewClickListener = new OnItemClickListener()
{
#Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id)
{
lastPubSelected = position;
drawLastPubSelected(lastPubSelected);
}
};
private void drawLastPubSelected(int position)
{
//get the selected pub
PubObj selectedPub = App.pubSortedByLastUpdate.get(position);
double pubLat = selectedPub.pubLatitude;
double pubLong = selectedPub.pubLongtitude;
//get the pub location
LatLng pubLocation = new LatLng(pubLat, pubLong);
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(pubLocation, 15);
//zoom the map to the pub
map.animateCamera(cameraUpdate);
//create the marker at the pub location
MarkerOptions mapMarkerOption = new MarkerOptions();
mapMarkerOption.position(pubLocation);
mapMarkerOption.title(selectedPub.pubName.toString() +" - "+selectedPub.pubAddress.toString());
mapMarkerOption.snippet(selectedPub.pubCurrentStatus.toString());
mapMarkerOption.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET));
mapMarkerOption.draggable(false);
map.clear();
Marker marker = map.addMarker(mapMarkerOption);
marker.showInfoWindow();
//on marker click open pub details activity
map.setOnInfoWindowClickListener(new OnInfoWindowClickListener()
{
#Override
public void onInfoWindowClick(Marker marker)
{
//open pub details activity
Log.d("pubs", "a");
}
});
}
now I have two devices that I debug on, the first one is samsung galaxy s2 with android version 4.1.2 and the other one is nexus 4 with android version 4.2.2 ,
the problem is that when I zoom in on my nexus 4 I see a blank screen (grey squares and I can see only the zoom buttons) and on my sgs2 i can zoom in and out without a problem and i see everything perfect.
What can be the problem?
I'm struggling with this issue for a quiet some time now.
Thank's in advance for all who can help.
Best,
Shalom Melamed.
Problem solved by completely delete the from my nexus 4 and re-install it.
Hope it will help anyone.
I have a listview of addresses in screen#1. On click of any item navigating to next screen which shows the map of clicked address. Now i want to swipe the screen to view the map of next address. Here is my code..
This is my map_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="#style/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayoutTopBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/scarlet"
android:gravity="center_vertical|center_horizontal" >
<TextView
android:id="#+id/textViewTopBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="Map"
android:textColor="#color/white"
android:textSize="20dp" />
</LinearLayout>
<com.xxx.android.yyyy.activities.HorizontalPager
android:id="#+id/horizontal_pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</com.xxx.android.yyyy.activities.HorizontalPager>
<ImageButton
android:id="#+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#null"
android:scaleType="fitCenter"
android:src="#drawable/button123" />
This is my map.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:apiKey="xxxxxxxxxxxxxxxxxxxxx"
android:clickable="true" />
</LinearLayout>
Activity :
public class MyMapActivity extends MapActivity
{
private MapView mapView;
private Drawable mapMarker;
private MyLocationOverlay myMap;
private MapController mapController;
private List<Overlay> overlayList;
private HorizontalPager hPager;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_screen);
hPager = (HorizontalPager) findViewById(R.id.horizontal_pager);
View inflatedView;
for (int i = 0; i < listViewSize; i++) //// getting listviewSize from intent extras
{
inflatedView = (View) View.inflate(MyMapActivity.this, R.layout.map, null);
mapView = (MapView) inflatedView.findViewById(R.id.mapview);
showMap(latt, longt); //getting all the latt, longt values of addresses from previous activity
hPager.addView(inflatedView);
}
hPager.setCurrentScreen(selectedAddressIndexInListView, false); //<<---- intent extras
}
void showMap(double latitude , double longitude )
{
mapView.setBuiltInZoomControls(true);
mapMarker = getResources().getDrawable(R.drawable.map_marker);
overlayList = mapView.getOverlays();
myMap = new MyLocationOverlay(this, mapView);
myMap.enableMyLocation();
mapController = mapView.getController();
GeoPoint geoPoint = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6));
mapController.animateTo(geoPoint);
mapController.setZoom(12);
OverlayItem overlayItem = new OverlayItem(geoPoint,"xxx", "yyy");
CustomPinpoint customPinpoint = new CustomPinpoint(mapMarker,MyMapActivity.this);
customPinpoint.insertPinpoint(overlayItem);
overlayList.clear();
overlayList.add(myMap);
overlayList.add(customPinpoint);
}
#Override
protected void onResume() {
super.onResume();
myMap.enableCompass();
myMap.enableMyLocation();
}
#Override
protected void onPause() {
super.onPause();
myMap.disableCompass();
myMap.disableMyLocation();
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
{ Reference : https://github.com/ysamlan/horizontalpager/tree/master/src/com/github/ysamlan/horizontalpager }
App is immediately force closing on click of any listview item..
Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity
Where iam going wrong? Everything works fine in following two cases.. 1. if i iterate the for loop only one time. 2. if i remove map view related lines from xml, activity files.
How can i have multiple maps in a single MapActivity with swiping?. Please help me
You can have only one Mapview per map activity, however, you can have multiple map activities in one application, which in your case wouldnt be a very ideal solution.
What you should do instead of having a totally new mapview for an address, you could have a different set of overlays for them. This way you'll only need to change the set of overlays when you want to view map details for another address. Besides being possible to make this with Android, its much more optimal than having multiple mapviews.
So far I know Currently Android supports only one MapView per MapActivity.