I am developing and app and am trying to implement google maps as an
activity of one my buttons. However, whenever I run the app, it crashes.
The following code works when certain lines are commented out. Without
them, I can't see the area i wish to zoom in on. I think i've narrowed the
issue down to the MapView, but i am not sure. Please Help!
*Java code*
package com.linzayhrst.cu;
import android.app.Activity;
import android.database.Observable;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
//import com.linzayhrst.cu.R;
import android.widget.TextView;
public class buttonTwo extends MapActivity{
TextView textOut;
MapController mControl;
GeoPoint GeoP;
MapView mapV;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.buttonscreen2);
mapV = (MapView) findViewById(R.id.map);
//mapV.displayZoomControls(true);
//mapV.setBuiltInZoomControls(true);
double lat = 43.0042;
double longi = -88.2279;
GeoP = new GeoPoint((int)(lat*1E6), (int)(longi*1E6));
//mControl = mapV.getController();
//mControl.animateTo(GeoP);
//mControl.setZoom(18);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
*xml code*
*
*
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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.maps.MapView
xmlns:android = "http://schemas.android.com/apk/res/android"
android:id = "@+id/map_view"
android:layout_width="fill_parent"
android:enabled = "true"
android:clickable = "true"
android:layout_height="fill_parent"
android:apiKey="0_KT38YhEenC4phM3fr6pVM6sJP0x0GlZ2fiQCw"
/>
</RelativeLayout>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en