sabo111

Please help me

Discussion created by sabo111 on Jun 5, 2012
Latest reply on Jun 6, 2012 by mehdiss5
Hi, I am trying to develop an android map application for my school project using the onemap. I had declared a mapView in my xml layout file and in my Activity java file, i add the onemap service as a layer to the mapView. But the layer that i have added only covers partial part of the android emulator screen, so I tried to use the zoomin method to see if the layer will cover a larger portion of the screen but nevertheless, it is still the same. Please help me see my codes to help me identify my errors and sorry for my bad english.

Below attached are my codes for xml layout file, Activity class and also the display on my emulator.
[ATTACH=CONFIG]14954[/ATTACH]
/* TtActivity.java */

package com.nyp;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

import com.esri.android.map.LocationService;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISDynamicMapServiceLayer;
import com.esri.core.symbol.SimpleMarkerSymbol;
import com.esri.core.symbol.SimpleMarkerSymbol.STYLE;

public class TtActivity extends Activity {

 MapView mMapView;

 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  // Retrieve the map and initial extent from XML layout
  mMapView = (MapView) findViewById(R.id.map);
  mMapView.addLayer(new ArcGISDynamicMapServiceLayer("http://www.onemap.sg/ArcGIS/rest/services/BASEMAP/MapServer"));
  mMapView.zoomin();
 }

 @Override
 protected void onDestroy() {
  super.onDestroy();
 }

 @Override
 protected void onPause() {
  super.onPause();
  mMapView.pause();
 }

 @Override
 protected void onResume() {
  super.onResume();
  mMapView.unpause();
 }
}


[HTML]
<!-- main.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" >

    <!-- MapView layout and initial extent -->

    <com.esri.android.map.MapView
        android:id="@+id/map"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>
[/HTML]

Attachments

Outcomes