(Android) How to set default gps position in mapview - android

So i have an app that has to show the location of a number of shops, depending on which one you choose.
The XML layout for the page with the mapView is part of a ViewFlipper, and the part that has the map layout is:
<RelativeLayout
android:id="#+id/RelativeLayout3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/back2"
android:gravity="left" >
<ImageButton
android:id="#+id/backLocation3"
android:layout_width="72dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/btn_zuruck2" />
<ImageView
android:id="#+id/imageViewMap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/backLocation3"
android:layout_marginTop="14dp"
android:src="#drawable/businesslounge" />
<RelativeLayout
android:id="#+id/mapPlaceHolderLayout"
android:layout_width="300dp"
android:layout_height="200dip"
android:layout_alignLeft="#+id/backLocation3"
android:layout_below="#+id/imageViewMap"
android:layout_marginTop="92dp" >
</RelativeLayout>
<TextView
android:id="#+id/mapLocation"
android:layout_width="240dp"
android:layout_height="40dp"
android:layout_alignLeft="#+id/mapPlaceHolderLayout"
android:layout_below="#+id/imageViewMap"
android:layout_marginTop="47dp"
android:text="#string/maplocation"
android:textSize="25dp"
android:textColor="#color/purple" />
<ImageButton
android:id="#+id/phonereserve"
android:layout_width="220dp"
android:layout_height="36dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="24dp"
android:src="#drawable/rezervephone" />
</RelativeLayout>
The part of the code that relates to the mapview is:
public class StandorteFragment extends MapHostFragment {
public String text2;
private RelativeLayout mapPlaceHolderLayout;
public AQuery aQuery;
private MapView myMapView;
private GeoPoint geoPoint;
private MapController mc;
#Override
protected Class<? extends Activity> getActivityClass() {
return LocationMapActivity.class;
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.location, container, false);
ViewFlipperStandorte = (ViewFlipper) v.findViewById(R.id.viewFlipperLocation);
geoPoint = new GeoPoint( (int) (48.949997* 1E6), (int) (22.140213 * 1E6));
mapPlaceHolderLayout = (RelativeLayout)v.findViewById(R.id.mapPlaceHolderLayout);
mapPlaceHolderLayout.addView(onCreateMapView());
// myMapView = (MapView) v.findViewById(R.id.mapPlaceHolderLayout);
// mc = myMapView.getController();
// mc.animateTo(geoPoint);
//
It works but doesn't show nothing in the mapView. If i don't comment those 3 lines with myMapView and animate geoPoint, it force closes.
What do I have to do?
EDIT: onCreateMapView:
public View onCreateMapView() {
Intent intent = new Intent(getActivity(), getActivityClass());
final Window w = getLocalActivityManager().startActivity(ACTIVITY_TAG,
intent);
final View wd = w != null ? w.getDecorView() : null;
if (wd != null) {
ViewParent parent = wd.getParent();
if (parent != null) {
ViewGroup v = (ViewGroup) parent;
v.removeView(wd);
}
wd.setVisibility(View.VISIBLE);
wd.setFocusableInTouchMode(true);
if (wd instanceof ViewGroup) {
((ViewGroup) wd)
.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
}
}
return wd;
}

Well the R.id.mapPLaceHolderLayout in your xml is not a mapview so you can't cast it to one. That line will cause an exception.

mapPlaceHolderLayout.addView(onCreateMapView()); called MapHostFragment which called LocalActivityManagerFragment which somehow goes to LocationMapActivity which extends MapActivity, so here i could instantiate the Mapcontroller and everything went as normal form there

Related

Add view in Android

I created a DrawCircle View Class to draw a Circle. I like to add this DrawCircle View Class to a fragment.
The DrawCircle View class is as follow.
public class DrawCircle extends View {
private Paint paint;
public DrawCircle(Context context) {
super(context);
// create the Paint and set its color
paint = new Paint();
paint.setColor(Color.WHITE);
}
#Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLUE);
canvas.drawCircle(200, 200, 100, paint);
}
}
Inside my fragment, I have a Layout already inflated.
public class GripForce extends Fragment{
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
v = inflater.inflate(R.layout.fragment_grip_force, container, false);
final Button buttonAcce = (Button) v.findViewById(R.id.gripbutton);
buttonAcce.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (vibrate == false) {
vibrate = true;
buttonAcce.setText("VIBRATE STOP");
// Vibrate for 300 milliseconds
timer = new Timer();
myTimerTask = new MyTimerTask();
timer.schedule(myTimerTask, 1, 80000);
mVibrator.vibrate(100000);
} else {
timer.cancel();
timer.purge();
mVibrator.cancel();
vibrate = false;
buttonAcce.setText("VIBRATE");
}
}
});
mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
return v;
}
}
My question is how to get this DrawCirle View on top of the existing View.
Thanks in advance.
EDIT:
I set the View in the xml.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.forcetest.GripForce">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top">
<com.abbott.forcetest.DrawCircle
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/circleView"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_gravity="center_horizontal|bottom">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="VIBRATE"
android:id="#+id/gripbutton"
android:background="#e71919"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="20dp" />
</LinearLayout>
</FrameLayout>
Then in the onCreateView, the program crashed at the line
v = inflater.inflate(R.layout.fragment_grip_force, container, false);
What is worng?
EDIT2:
I changed my xml to
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.abbott.forcetest.GripForce"
android:id="#+id/gripLayout">
<!--<LinearLayout-->
<!--android:orientation="vertical"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_gravity="center_horizontal|top">-->
<!--<com.abbott.forcetest.DrawCircle-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:id="#+id/circleView"-->
<!--android:layout_weight="1"/>-->
<!--</LinearLayout>-->
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_gravity="center_horizontal|bottom">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="VIBRATE"
android:id="#+id/gripbutton"
android:background="#e71919"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="20dp" />
</LinearLayout>
</FrameLayout>
Then in the program,
final FrameLayout l_out = (FrameLayout) v.findViewById(R.id.gripLayout);
DrawCircle circleVIew = new DrawCircle(this.getContext());
l_out.addView(circleVIew);
It works now.
Just add it like you would add any other view dynamically.
Just create it -
DrawCircle circle = new DrawCircle(context);
Then add it to your your parent layout -
yourParentLayout.addView(circle);
Set any properties you want while adding the circle view to place it accordingly.
See here how to add views dynamically.
You are trying to self-define view. And now assuming that you already make everything related to the view drawing fine( I haven't check your code related to view drawing), and now what you need to do to place that view is just simply code it in your layout file.
Like this:
<com.example.yourprojectname.DrawCircle
android:layout_width=xxxx
android:layout_height=xxx
/>
Like what you do to TextView or Button, code it in layout xml file and remember to findViewById in you java code. It will appear.
And of course you could do it programmingly, try addView method in your code. But write it in xml file is a little bit easier, also you can define the position you want that view to show up.

Dynamically change View Stub layout_height attribute?

I am using view stub in my application. I am inflating the view stub to the layout and it is working fine. Now if you see the dummy_layout.xml there I have given the android:layout_height=20dp. What I need to do is to change that view stub height from 20 dp to Wrap_Content on a button click. How can I achieve this?
My ultimate goal is this. I have a button in it. when i click on it for first time I need to show the full layout of stub. and again when I click on it for the second time I need to animate the stub to slide down and show only a part of it.
dummy_layout.xml
<RelativeLayout
android:id="#+id/topLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="#drawable/ic_watch_pic" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#color/dark_grey"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Button" />
</RelativeLayout>
<ViewStub
android:id="#+id/viewStub1"
android:layout="#layout/stub_layout"
android:layout_width="wrap_content"
**android:layout_height="20dp"**
android:layout_alignParentBottom="true"/>
</RelativeLayout>
And here is my class:
public class DummyFragment extends Fragment {
private View mRootView;
private Context mContext;
private Button mButton;
private boolean isVisible = true;
private RelativeLayout mParentLayout;
#Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mRootView = inflater.inflate(R.layout.dummy_layout,
container, false);
mContext = getActivity();
mButton = (Button) mTopLayout.findViewById(R.id.button1);
final ViewStub stub = (ViewStub) mRootView.findViewById(R.id.viewStub1);
**final View inflated = stub.inflate();**
inflated.setVisibility(View.VISIBLE);
final View viewstublayout = mRootView.findViewById(R.id.viewStub1);
mButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
if(isVisible)
{
isVisible=false;
inflated.setVisibility(View.VISIBLE);
}
else
{
isVisible=true;
inflated.setVisibility(View.INVISIBLE);
}
}
});
return mRootView;
}
}
You can change the width/height of a view by editing its LayoutParams. Example:
View stub = findViewById(R.id.viewStub1);
ViewGroup.LayoutParams lp = stub.getLayoutParams();
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
stub.setLayoutParams(lp);
The better question is why you want to do this? Maybe there's a better way of achieving your goal.
Try this
final ViewStub stub = (ViewStub) mRootView.findViewById(R.id.viewStub1);
View view = stub .inflate();
inside button click
LayoutParams params = (LayoutParams) view.getLayoutParams();
params.width = LayoutParams.WRAP_CONTENT;
view.setLayoutParams(params);
Try this and let me know if works well.
LayoutParams lp = (LayoutParams) (YourView).getLayoutParams();
lp.height = newheight;
YourView.setLayoutParams(lp);

Android - Reference to layout element found but cannot retrieve element

I have two layouts one for my main activity and second for my custom dialog which looks like this:
<?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"
android:background="#FFFFFF" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.51"
android:orientation="horizontal">
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/a1" />
<TextView
android:id="#+id/owner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
Now in my main activity I have onCreate method:
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if(...)
{
...
if(...)
{
// Load the map
setContentView(R.layout.activity_map);
// Fetch dropdown list & gps button
spinner = (Spinner) findViewById(R.id.bankslist);
gps = (Button) findViewById(R.id.gpsbttn);
// When this runs both spinner & gps != null
// Now I register a listner for my GoogleMap object
map.setMapMarkerOnClickListener(new ShowDetails(this));
} else {
...
}
} else {
...
}
}
Inside my main activity I have an inner class that extends OnMapMarkerClickListener:
class ShowDetails implements OnMarkerClickListener
{
private FragmentActivity context;
public ShowDetails(FragmentActivity context)
{
this.context = context;
}
public boolean onMarkerClick(Marker marker)
{
// Check if selected marker is mapped to a Atm
if(markers.containsKey(marker))
{
// Fetch ATM associated with marker
Atm atm = markers.get(marker);
// Create a new Dialog instance to display ATM
// associated data
Dialog msg = new Dialog(context);
msg.setContentView(R.layout.info_dialog);
msg.setTitle(atm.getOwner());
ImageView logo = (ImageView) context.findViewById(R.id.logo);
TextView owner = (TextView) context.findViewById(R.id.owner);
if(logo == null)
{
Log.w("ILG", "LOGO IS NULL");
}
}
return true;
}
}
In this inner class, I'm trying to get a reference to the logo and owner attributes which are part of the info_dialog.xml layout file even tho both are in R. I always gett logo/owner == null. The findViewById(..) never returns a valid object.
Since those Views are inside info_dialog.xml which you didn't inflate with setContentView(), you need to inflate that layout and use that to get a reference to the Views.
LayoutInflater inflater = context.getSystemService.(Context.LAYOUT_INFLATER_SERVICE);
View root= inflater.inflate(R.layout.info_dialog, null);
msg.setContentView(root); // can use it here
msg.setTitle(atm.getOwner());
ImageView logo = (ImageView) root.findViewById(R.id.logo); // change
TextView owner = (TextView) root.findViewById(R.id.owner); // these lines

How to offset the balloon view in a marker in Google Map V2?

When I click a marker, appears a balloon. But there are too space between the marker and the balloon, so how I can reduce this distance?. It's like using the setBalloonBottomOffset method in the V1 Google Map.
My custom balloon is this class:
public class CustomInfoWindowAdapter implements InfoWindowAdapter {
private final View mWindow;
private final View mContents;
public CustomInfoWindowAdapter(Activity activity) {
LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mWindow = inflater.inflate(R.layout.ballon, null);
mContents = inflater.inflate(R.layout.ballon, null);
}
#Override
public View getInfoWindow(Marker marker) {
render(marker, mWindow);
return mWindow;
}
#Override
public View getInfoContents(Marker marker) {
render(marker, mContents);
return mContents;
}
private void render(Marker marker, View view) {
String title = marker.getTitle();
TextView titleUi = ((TextView) view.findViewById(R.id.txtTitle));
if (title != null) {
titleUi.setText(title);
} else {
titleUi.setText("");
}
String snippet = marker.getSnippet();
TextView snippetUi = ((TextView) view.findViewById(R.id.txtPlace));
if (snippet != null) {
snippetUi.setText(snippet);
} else {
snippetUi.setText("");
}
}
}
I show a marker like
marker.showInfoWindow();
My balloon xml is
<RelativeLayout
android:layout_width="250dp"
android:layout_height="75dp"
android:background="#drawable/ballon" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<TextView
android:id="#+id/txtTitle"
style="#style/Ballon_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:paddingLeft="15dp"
android:paddingRight="50dp"
android:paddingTop="10dp"
android:singleLine="true"
android:text="Con mis amigos amigos" />
<TextView
android:id="#+id/txtPlace"
style="#style/Ballon_Place"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:paddingBottom="20dp"
android:paddingLeft="15dp"
android:paddingRight="50dp"
android:singleLine="true"
android:text="Puerta del sol" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</RelativeLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="12dp"
android:paddingTop="18dp"
android:src="#drawable/icon_arrow" />
</RelativeLayout>
Map Markers are 'anchored' by default to the middle of the bottom of your layout (i.e., anchor(0.5,1)).
You can change the anchor point by using MarkerOptions.anchor when you create your Marker.
Have you tried using negative bottom margin for your whole balloon layout? Like so:
<RelativeLayout
android:layout_width="250dp"
android:layout_height="75dp"
android:background="#drawable/ballon"
android:layout_marginBottom="-8dp" >
Probably won't work or cause content to be cut off at the bottom, but still worth trying as the simplest approach. Perhaps there's another way to trick GoogleMap class but it's hard to figure out not having the source code to the API.
Another tip: you probably don't need your getInfoContents() method – just return null there. This method will only be called if you return null from getInfoWindow() (see here) – to incorporate your content view into default info window, which is clearly not your goal since you want to move balloon around.
Consequently, you can also throw out mContents, it's totally redundant, just takes up mem for another copy of your inflated view hierarchy that never gets used.
Tell me if the margin thing works for you. We could probably also try to make use of something like ((View)mWindow.getParent()) later when the item is being displayed but that would be trickier so I sugget to just try the margin first.
This is an old question, the current API has a MarkerOptions.infoWindowAnchor method which may help.

Multiple maps (with swiping) in a MapActivity in android

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.

Categories

Resources