/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load a webmap.
map = new MapView(this, "http://www.arcgis.com/home/item.html?id=ec84873154cf43069c407", "", "");
setContentView(map);/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapscreen);
// Retrieve the map and initial extent from XML layout
map = (MapView) findViewById (R.id.map);
// This adds ESRI's titled map service layer "World Street Map" to the MapView, as well as DHEC's
// dynamics map service "MPOS"
map.addLayer(new ArcGISTiledMapServiceLayer("" +
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
map.addLayer(new ArcGISDynamicMapServiceLayer("" +
"http://TEST/ArcGIS/rest/services/Mobile/TRSS/MapServer"));
//Setting up the button reference.
ZoomToMyLocation = (Button) findViewById (R.id.button1); /** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load a webmap.
map = new MapView(this, "http://www.arcgis.com/home/item.html?id=ec84873069c408", "", "");
setContentView(map);
// Post create PopupWindow since it created during onCreate().
final Context context = this;
map.post(
new Runnable()
{
public void run()
{
popupWindow = new PopupWindow(context);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
Button button = new Button(context);
button.setText("Zoom To My Location");
linearLayout.addView(button);
popupWindow.setContentView(linearLayout);
popupWindow.showAtLocation(linearLayout, Gravity.LEFT | Gravity.BOTTOM, 10, 10);
popupWindow.update(250,64);
}
});public class MapscreenTwo extends Activity {
public MapView map;
public ImageView ZoomToMyLocation;
....
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapscreentwo);
// Retrieve the map and initial extent from XML layout
map = (MapView) findViewById (R.id.map);
//Setting up the button (Image View) reference.
ZoomToMyLocation = (ImageView) findViewById (R.id.gpsicon);
//This listens for when the ZoomToMyLocation button (Image View) is pressed.
ZoomToMyLocation.setOnClickListener(new View.OnClickListener() {<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- MapView layout and initial extent --> <com.esri.android.map.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="match_parent" url="http://www.arcgis.com/home/item.html?id=ec84873154cf4d7f" > </com.esri.android.map.MapView> <LinearLayout android:orientation="horizontal" android:gravity="left" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/gpsicon" android:layout_width="55dp" android:layout_height="54dp" android:src="@drawable/gpsicon" /> </LinearLayout> </RelativeLayout>